home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / GameCreators / TADS / manuals / TEX / TADSEX.TEX < prev    next >
LaTeX Document  |  1993-03-16  |  93.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: TADSEX.TEX

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document, ASCII text, with CRLF line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried x-fmt/111 Plain Text File default
100% detectItEasy Format: plain text[CRLF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 24 48 65 61 64 65 | 72 3a 20 63 3a 2f 74 61 |% $Heade|r: c:/ta|
|00000010| 64 73 2f 64 6f 63 2f 52 | 43 53 2f 74 61 64 73 65 |ds/doc/R|CS/tadse|
|00000020| 78 2e 74 65 78 20 31 2e | 31 20 39 32 2f 31 31 2f |x.tex 1.|1 92/11/|
|00000030| 31 33 20 31 36 3a 34 36 | 3a 30 32 20 6d 72 6f 62 |13 16:46|:02 mrob|
|00000040| 65 72 74 73 20 45 78 70 | 20 4c 6f 63 6b 65 72 3a |erts Exp| Locker:|
|00000050| 20 6d 72 6f 62 65 72 74 | 73 20 24 0d 0a 25 0d 0a | mrobert|s $..%..|
|00000060| 25 20 54 41 44 53 20 64 | 6f 63 75 6d 65 6e 74 61 |% TADS d|ocumenta|
|00000070| 74 69 6f 6e 3a 20 20 41 | 64 76 61 6e 63 65 64 20 |tion: A|dvanced |
|00000080| 50 72 6f 67 72 61 6d 6d | 69 6e 67 20 45 78 61 6d |Programm|ing Exam|
|00000090| 70 6c 65 73 0d 0a 25 0d | 0a 25 20 43 6f 70 79 72 |ples..%.|.% Copyr|
|000000a0| 69 67 68 74 20 28 63 29 | 20 31 39 38 39 20 62 79 |ight (c)| 1989 by|
|000000b0| 20 4d 69 63 68 61 65 6c | 20 4a 2e 20 52 6f 62 65 | Michael| J. Robe|
|000000c0| 72 74 73 2e 20 20 41 6c | 6c 20 52 69 67 68 74 73 |rts. Al|l Rights|
|000000d0| 20 52 65 73 65 72 76 65 | 64 2e 0d 0a 25 0d 0a 0d | Reserve|d...%...|
|000000e0| 0a 5c 63 68 61 70 74 65 | 72 68 65 61 64 65 72 7b |.\chapte|rheader{|
|000000f0| 43 68 61 70 74 65 72 20 | 53 65 76 65 6e 7d 7b 41 |Chapter |Seven}{A|
|00000100| 64 76 61 6e 63 65 64 20 | 54 41 44 53 20 54 65 63 |dvanced |TADS Tec|
|00000110| 68 6e 69 71 75 65 73 7d | 7b 37 7d 0d 0a 0d 0a 53 |hniques}|{7}....S|
|00000120| 6f 20 66 61 72 2c 20 77 | 65 27 76 65 20 63 6f 6e |o far, w|e've con|
|00000130| 63 65 6e 74 72 61 74 65 | 64 20 6f 6e 20 74 68 65 |centrate|d on the|
|00000140| 20 62 61 73 69 63 20 61 | 73 70 65 63 74 73 20 6f | basic a|spects o|
|00000150| 66 20 77 72 69 74 69 6e | 67 20 61 0d 0a 67 61 6d |f writin|g a..gam|
|00000160| 65 20 77 69 74 68 20 54 | 41 44 53 2e 20 20 4f 6e |e with T|ADS. On|
|00000170| 63 65 20 79 6f 75 20 67 | 65 74 20 73 74 61 72 74 |ce you g|et start|
|00000180| 65 64 20 6f 6e 20 61 20 | 67 61 6d 65 2c 20 79 6f |ed on a |game, yo|
|00000190| 75 20 77 69 6c 6c 20 70 | 72 6f 62 61 62 6c 79 0d |u will p|robably.|
|000001a0| 0a 68 61 76 65 20 6c 6f | 74 73 20 6f 66 20 69 64 |.have lo|ts of id|
|000001b0| 65 61 73 20 66 6f 72 20 | 70 6c 6f 74 20 65 6c 65 |eas for |plot ele|
|000001c0| 6d 65 6e 74 73 20 69 6e | 20 79 6f 75 72 20 67 61 |ments in| your ga|
|000001d0| 6d 65 2e 20 20 4d 61 6e | 79 20 70 61 72 74 73 20 |me. Man|y parts |
|000001e0| 6f 66 0d 0a 61 6e 20 61 | 64 76 65 6e 74 75 72 65 |of..an a|dventure|
|000001f0| 20 67 61 6d 65 20 63 61 | 6e 20 62 65 20 69 6d 70 | game ca|n be imp|
|00000200| 6c 65 6d 65 6e 74 65 64 | 20 76 65 72 79 20 65 61 |lemented| very ea|
|00000210| 73 69 6c 79 20 77 69 74 | 68 20 54 41 44 53 2c 20 |sily wit|h TADS, |
|00000220| 73 69 6d 70 6c 79 0d 0a | 62 79 20 70 69 65 63 69 |simply..|by pieci|
|00000230| 6e 67 20 74 6f 67 65 74 | 68 65 72 20 74 68 65 20 |ng toget|her the |
|00000240| 62 61 73 69 63 20 63 6c | 61 73 73 65 73 20 66 72 |basic cl|asses fr|
|00000250| 6f 6d 20 7b 5c 74 74 20 | 61 64 76 2e 74 7d 20 61 |om {\tt |adv.t} a|
|00000260| 6e 64 20 66 69 6c 6c 69 | 6e 67 0d 0a 69 6e 20 64 |nd filli|ng..in d|
|00000270| 65 73 63 72 69 70 74 69 | 6f 6e 73 2c 20 6c 6f 63 |escripti|ons, loc|
|00000280| 61 74 69 6f 6e 73 2c 20 | 61 6e 64 20 73 6f 20 66 |ations, |and so f|
|00000290| 6f 72 74 68 2e 20 20 48 | 6f 77 65 76 65 72 2c 20 |orth. H|owever, |
|000002a0| 73 6f 6d 65 20 6f 66 20 | 74 68 65 0d 0a 74 68 69 |some of |the..thi|
|000002b0| 6e 67 73 20 79 6f 75 20 | 77 69 6c 6c 20 77 61 6e |ngs you |will wan|
|000002c0| 74 20 74 6f 20 69 6d 70 | 6c 65 6d 65 6e 74 20 77 |t to imp|lement w|
|000002d0| 6f 6e 27 74 20 62 65 20 | 74 68 61 74 20 65 61 73 |on't be |that eas|
|000002e0| 79 2c 20 61 6e 64 20 79 | 6f 75 0d 0a 77 69 6c 6c |y, and y|ou..will|
|000002f0| 20 6e 65 65 64 20 74 6f | 20 64 6f 20 73 6f 6d 65 | need to| do some|
|00000300| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 2e 0d 0a 0d | program|ming....|
|00000310| 0a 54 68 69 73 20 63 68 | 61 70 74 65 72 20 69 73 |.This ch|apter is|
|00000320| 20 69 6e 74 65 6e 64 65 | 64 20 74 6f 20 68 65 6c | intende|d to hel|
|00000330| 70 20 79 6f 75 20 72 65 | 61 6c 69 7a 65 20 79 6f |p you re|alize yo|
|00000340| 75 72 20 6d 6f 72 65 20 | 63 6f 6d 70 6c 65 78 0d |ur more |complex.|
|00000350| 0a 69 64 65 61 73 20 62 | 79 20 73 68 6f 77 69 6e |.ideas b|y showin|
|00000360| 67 20 68 6f 77 20 74 6f | 20 69 6d 70 6c 65 6d 65 |g how to| impleme|
|00000370| 6e 74 20 61 20 6e 75 6d | 62 65 72 20 6f 66 20 73 |nt a num|ber of s|
|00000380| 6f 70 68 69 73 74 69 63 | 61 74 65 64 0d 0a 70 6c |ophistic|ated..pl|
|00000390| 6f 74 20 65 6c 65 6d 65 | 6e 74 73 2e 20 20 57 65 |ot eleme|nts. We|
|000003a0| 27 76 65 20 74 72 69 65 | 64 20 74 6f 20 73 68 6f |'ve trie|d to sho|
|000003b0| 77 20 65 78 61 6d 70 6c | 65 73 20 6f 66 20 74 68 |w exampl|es of th|
|000003c0| 65 20 6d 6f 73 74 20 63 | 6f 6d 6d 6f 6e 0d 0a 64 |e most c|ommon..d|
|000003d0| 69 66 66 69 63 75 6c 74 | 20 67 61 6d 65 20 66 65 |ifficult| game fe|
|000003e0| 61 74 75 72 65 73 2c 20 | 73 6f 20 74 68 65 72 65 |atures, |so there|
|000003f0| 27 73 20 61 20 67 6f 6f | 64 20 63 68 61 6e 63 65 |'s a goo|d chance|
|00000400| 20 74 68 61 74 20 79 6f | 75 27 6c 6c 0d 0a 66 69 | that yo|u'll..fi|
|00000410| 6e 64 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 69 6e |nd an ex|ample in|
|00000420| 20 74 68 69 73 20 63 68 | 61 70 74 65 72 20 74 68 | this ch|apter th|
|00000430| 61 74 27 73 20 76 65 72 | 79 20 73 69 6d 69 6c 61 |at's ver|y simila|
|00000440| 72 20 74 6f 20 77 68 61 | 74 0d 0a 79 6f 75 27 72 |r to wha|t..you'r|
|00000450| 65 20 74 72 79 69 6e 67 | 20 74 6f 20 64 6f 2e 20 |e trying| to do. |
|00000460| 20 45 76 65 6e 20 69 66 | 20 79 6f 75 20 64 6f 6e | Even if| you don|
|00000470| 27 74 20 66 69 6e 64 20 | 61 20 63 6c 6f 73 65 0d |'t find |a close.|
|00000480| 0a 6d 61 74 63 68 20 74 | 6f 20 74 68 65 20 66 65 |.match t|o the fe|
|00000490| 61 74 75 72 65 20 79 6f | 75 20 68 61 76 65 20 69 |ature yo|u have i|
|000004a0| 6e 20 6d 69 6e 64 2c 20 | 72 65 61 64 69 6e 67 20 |n mind, |reading |
|000004b0| 74 68 69 73 20 63 68 61 | 70 74 65 72 0d 0a 77 69 |this cha|pter..wi|
|000004c0| 6c 6c 20 73 68 6f 77 20 | 79 6f 75 20 6d 61 6e 79 |ll show |you many|
|000004d0| 20 6f 66 20 74 68 65 20 | 6d 6f 72 65 20 73 75 62 | of the |more sub|
|000004e0| 74 6c 65 20 70 6f 69 6e | 74 73 20 6f 66 20 54 41 |tle poin|ts of TA|
|000004f0| 44 53 20 70 72 6f 67 72 | 61 6d 6d 69 6e 67 2c 0d |DS progr|amming,.|
|00000500| 0a 77 68 69 63 68 20 73 | 68 6f 75 6c 64 20 67 69 |.which s|hould gi|
|00000510| 76 65 20 79 6f 75 20 61 | 20 62 65 74 74 65 72 20 |ve you a| better |
|00000520| 69 64 65 61 20 6f 66 20 | 68 6f 77 20 74 6f 20 69 |idea of |how to i|
|00000530| 6d 70 6c 65 6d 65 6e 74 | 20 79 6f 75 72 0d 0a 69 |mplement| your..i|
|00000540| 64 65 61 73 2e 5c 62 75 | 6c 6c 0d 0a 0d 0a 0d 0a |deas.\bu|ll......|
|00000550| 5c 63 68 61 70 74 65 72 | 62 6f 64 79 0d 0a 0d 0a |\chapter|body....|
|00000560| 5c 6d 61 6a 6f 72 73 65 | 63 74 69 6f 6e 7b 43 72 |\majorse|ction{Cr|
|00000570| 65 61 74 69 6e 67 20 79 | 6f 75 72 20 6f 77 6e 20 |eating y|our own |
|00000580| 56 65 72 62 73 7d 0d 0a | 0d 0a 5e 5e 7b 76 65 72 |Verbs}..|..^^{ver|
|00000590| 62 7d 0d 0a 49 74 27 73 | 20 61 6c 77 61 79 73 20 |b}..It's| always |
|000005a0| 62 65 73 74 20 74 6f 20 | 74 72 79 20 74 6f 20 6c |best to |try to l|
|000005b0| 69 6d 69 74 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |imit the| number |
|000005c0| 6f 66 20 76 65 72 62 73 | 20 61 20 70 6c 61 79 65 |of verbs| a playe|
|000005d0| 72 20 6e 65 65 64 73 0d | 0a 74 6f 20 75 73 65 20 |r needs.|.to use |
|000005e0| 74 6f 20 63 6f 6d 70 6c | 65 74 65 20 79 6f 75 72 |to compl|ete your|
|000005f0| 20 67 61 6d 65 2c 20 62 | 65 63 61 75 73 65 20 69 | game, b|ecause i|
|00000600| 74 20 68 65 6c 70 73 20 | 70 72 65 76 65 6e 74 20 |t helps |prevent |
|00000610| 79 6f 75 72 0d 0a 61 64 | 76 65 6e 74 75 72 65 20 |your..ad|venture |
|00000620| 66 72 6f 6d 20 62 65 63 | 6f 6d 69 6e 67 20 61 20 |from bec|oming a |
|00000630| 67 61 6d 65 20 6f 66 20 | 60 60 67 75 65 73 73 20 |game of |``guess |
|00000640| 74 68 65 20 76 65 72 62 | 2e 27 27 20 20 43 68 6f |the verb|.'' Cho|
|00000650| 6f 73 69 6e 67 0d 0a 74 | 68 65 20 72 69 67 68 74 |osing..t|he right|
|00000660| 20 73 65 6e 74 65 6e 63 | 65 20 74 6f 20 65 78 70 | sentenc|e to exp|
|00000670| 72 65 73 73 20 61 6e 20 | 69 64 65 61 20 66 6f 72 |ress an |idea for|
|00000680| 20 61 20 63 6f 6d 6d 61 | 6e 64 20 73 68 6f 75 6c | a comma|nd shoul|
|00000690| 64 20 6e 65 76 65 72 0d | 0a 62 65 20 61 20 63 68 |d never.|.be a ch|
|000006a0| 61 6c 6c 65 6e 67 65 2d | 2d 2d 69 66 20 69 74 20 |allenge-|--if it |
|000006b0| 69 73 2c 20 79 6f 75 72 | 20 67 61 6d 65 20 77 69 |is, your| game wi|
|000006c0| 6c 6c 20 71 75 69 63 6b | 6c 79 20 62 65 63 6f 6d |ll quick|ly becom|
|000006d0| 65 20 75 6e 69 6e 74 65 | 72 65 73 74 69 6e 67 2e |e uninte|resting.|
|000006e0| 0d 0a 0d 0a 48 6f 77 65 | 76 65 72 2c 20 74 68 61 |....Howe|ver, tha|
|000006f0| 74 20 62 65 69 6e 67 20 | 73 61 69 64 2c 20 79 6f |t being |said, yo|
|00000700| 75 20 77 69 6c 6c 20 73 | 6f 6d 65 74 69 6d 65 73 |u will s|ometimes|
|00000710| 20 77 61 6e 74 20 74 6f | 20 69 6e 63 6c 75 64 65 | want to| include|
|00000720| 20 73 69 74 75 61 74 69 | 6f 6e 73 0d 0a 69 6e 20 | situati|ons..in |
|00000730| 79 6f 75 72 20 67 61 6d | 65 73 20 74 68 61 74 20 |your gam|es that |
|00000740| 63 61 6c 6c 20 66 6f 72 | 20 76 65 72 62 73 20 74 |call for| verbs t|
|00000750| 68 61 74 20 61 72 65 6e | 27 74 20 69 6e 20 74 68 |hat aren|'t in th|
|00000760| 65 20 73 65 74 20 64 65 | 66 69 6e 65 64 20 69 6e |e set de|fined in|
|00000770| 0d 0a 7b 5c 74 74 20 61 | 64 76 2e 74 7d 2e 20 20 |..{\tt a|dv.t}. |
|00000780| 49 6e 20 61 64 64 69 74 | 69 6f 6e 2c 20 74 68 65 |In addit|ion, the|
|00000790| 72 65 27 73 20 6e 6f 74 | 68 69 6e 67 20 77 72 6f |re's not|hing wro|
|000007a0| 6e 67 20 77 69 74 68 20 | 6d 61 6b 69 6e 67 20 79 |ng with |making y|
|000007b0| 6f 75 72 0d 0a 67 61 6d | 65 20 75 6e 64 65 72 73 |our..gam|e unders|
|000007c0| 74 61 6e 64 20 6f 62 73 | 63 75 72 65 20 76 65 72 |tand obs|cure ver|
|000007d0| 62 73 20 61 6e 64 20 70 | 68 72 61 73 69 6e 67 73 |bs and p|hrasings|
|000007e0| 20 74 68 61 74 20 61 72 | 65 20 7b 5c 69 74 20 61 | that ar|e {\it a|
|000007f0| 6c 74 65 72 6e 61 74 69 | 76 65 73 7d 0d 0a 74 6f |lternati|ves}..to|
|00000800| 20 6f 6e 65 20 6f 66 20 | 74 68 65 20 6d 6f 72 65 | one of |the more|
|00000810| 20 63 6f 6d 6d 6f 6e 20 | 76 65 72 62 73 20 69 6e | common |verbs in|
|00000820| 20 7b 5c 74 74 20 61 64 | 76 2e 74 7d 2e 20 20 46 | {\tt ad|v.t}. F|
|00000830| 75 72 74 68 65 72 6d 6f | 72 65 2c 20 73 6f 6d 65 |urthermo|re, some|
|00000840| 0d 0a 67 61 6d 65 73 20 | 69 6e 63 6c 75 64 65 20 |..games |include |
|00000850| 60 60 6d 61 67 69 63 20 | 77 6f 72 64 73 27 27 20 |``magic |words'' |
|00000860| 74 68 61 74 20 61 72 65 | 20 65 66 66 65 63 74 69 |that are| effecti|
|00000870| 76 65 6c 79 20 73 70 65 | 63 69 61 6c 20 76 65 72 |vely spe|cial ver|
|00000880| 62 73 3b 0d 0a 73 69 6e | 63 65 20 74 68 65 20 70 |bs;..sin|ce the p|
|00000890| 6c 61 79 65 72 20 6c 65 | 61 72 6e 73 20 74 68 65 |layer le|arns the|
|000008a0| 73 65 20 77 69 74 68 69 | 6e 20 74 68 65 20 67 61 |se withi|n the ga|
|000008b0| 6d 65 2c 20 6f 62 73 63 | 75 72 69 74 79 20 69 73 |me, obsc|urity is|
|000008c0| 20 6e 6f 74 20 61 0d 0a | 70 72 6f 62 6c 65 6d 2e | not a..|problem.|
|000008d0| 0d 0a 0d 0a 54 68 65 20 | 77 61 79 20 79 6f 75 20 |....The |way you |
|000008e0| 61 64 64 20 61 20 76 65 | 72 62 20 64 65 70 65 6e |add a ve|rb depen|
|000008f0| 64 73 20 6f 6e 20 68 6f | 77 20 74 68 65 20 76 65 |ds on ho|w the ve|
|00000900| 72 62 20 69 73 20 75 73 | 65 64 2e 20 20 54 68 65 |rb is us|ed. The|
|00000910| 20 73 69 6d 70 6c 65 73 | 74 0d 0a 6b 69 6e 64 20 | simples|t..kind |
|00000920| 6f 66 20 76 65 72 62 20 | 69 73 20 75 73 65 64 20 |of verb |is used |
|00000930| 62 79 20 69 74 73 65 6c | 66 2d 2d 2d 74 68 65 20 |by itsel|f---the |
|00000940| 70 6c 61 79 65 72 20 64 | 6f 65 73 6e 27 74 20 69 |player d|oesn't i|
|00000950| 6e 63 6c 75 64 65 20 61 | 6e 79 0d 0a 6f 62 6a 65 |nclude a|ny..obje|
|00000960| 63 74 73 20 69 6e 20 61 | 20 63 6f 6d 6d 61 6e 64 |cts in a| command|
|00000970| 20 77 69 74 68 20 74 68 | 65 20 76 65 72 62 2e 20 | with th|e verb. |
|00000980| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 60 60 | For exa|mple, ``|
|00000990| 6e 6f 72 74 68 27 27 20 | 69 73 0d 0a 61 20 76 65 |north'' |is..a ve|
|000009a0| 72 62 20 74 68 61 74 20 | 64 6f 65 73 6e 27 74 20 |rb that |doesn't |
|000009b0| 74 61 6b 65 20 61 6e 79 | 20 6f 62 6a 65 63 74 73 |take any| objects|
|000009c0| 3b 20 6d 61 67 69 63 20 | 77 6f 72 64 73 20 67 65 |; magic |words ge|
|000009d0| 6e 65 72 61 6c 6c 79 20 | 66 61 6c 6c 0d 0a 69 6e |nerally |fall..in|
|000009e0| 74 6f 20 74 68 69 73 20 | 63 61 74 65 67 6f 72 79 |to this |category|
|000009f0| 20 61 73 20 77 65 6c 6c | 2e 20 20 54 6f 20 69 6d | as well|. To im|
|00000a00| 70 6c 65 6d 65 6e 74 20 | 61 20 76 65 72 62 20 77 |plement |a verb w|
|00000a10| 69 74 68 20 6e 6f 20 6f | 62 6a 65 63 74 73 2c 0d |ith no o|bjects,.|
|00000a20| 0a 61 6c 6c 20 79 6f 75 | 20 68 61 76 65 20 74 6f |.all you| have to|
|00000a30| 20 64 6f 20 69 73 20 63 | 72 65 61 74 65 20 61 20 | do is c|reate a |
|00000a40| 7b 5c 74 74 20 64 65 65 | 70 76 65 72 62 7d 20 6f |{\tt dee|pverb} o|
|00000a50| 62 6a 65 63 74 20 74 68 | 61 74 20 69 6e 63 6c 75 |bject th|at inclu|
|00000a60| 64 65 73 0d 0a 61 20 7b | 5c 74 74 20 76 65 72 62 |des..a {|\tt verb|
|00000a70| 7d 20 76 6f 63 61 62 75 | 6c 61 72 79 20 70 72 6f |} vocabu|lary pro|
|00000a80| 70 65 72 74 79 2c 20 61 | 6e 20 7b 5c 74 74 20 73 |perty, a|n {\tt s|
|00000a90| 64 65 73 63 7d 20 70 72 | 6f 70 65 72 74 79 2c 20 |desc} pr|operty, |
|00000aa0| 61 6e 64 0d 0a 61 6e 20 | 7b 5c 74 74 20 61 63 74 |and..an |{\tt act|
|00000ab0| 69 6f 6e 28 61 63 74 6f | 72 29 7d 20 6d 65 74 68 |ion(acto|r)} meth|
|00000ac0| 6f 64 2e 20 20 28 54 68 | 65 20 7b 5c 74 74 20 64 |od. (Th|e {\tt d|
|00000ad0| 65 65 70 76 65 72 62 7d | 20 63 6c 61 73 73 20 69 |eepverb}| class i|
|00000ae0| 73 0d 0a 64 65 66 69 6e | 65 64 20 69 6e 20 7b 5c |s..defin|ed in {\|
|00000af0| 74 74 20 61 64 76 2e 74 | 7d 3b 20 73 65 65 20 41 |tt adv.t|}; see A|
|00000b00| 70 70 65 6e 64 69 78 20 | 41 20 66 6f 72 20 64 65 |ppendix |A for de|
|00000b10| 74 61 69 6c 73 2e 29 0d | 0a 54 68 65 20 7b 5c 74 |tails.).|.The {\t|
|00000b20| 74 20 61 63 74 69 6f 6e | 7d 20 6d 65 74 68 6f 64 |t action|} method|
|00000b30| 20 69 73 20 63 61 6c 6c | 65 64 0d 0a 77 68 65 6e | is call|ed..when|
|00000b40| 20 74 68 65 20 76 65 72 | 62 20 69 73 20 75 73 65 | the ver|b is use|
|00000b50| 64 20 77 69 74 68 20 6e | 6f 20 6f 62 6a 65 63 74 |d with n|o object|
|00000b60| 73 2e 20 20 41 73 20 61 | 6e 20 65 78 61 6d 70 6c |s. As a|n exampl|
|00000b70| 65 2c 20 6c 65 74 27 73 | 20 69 6d 70 6c 65 6d 65 |e, let's| impleme|
|00000b80| 6e 74 0d 0a 61 20 76 65 | 72 62 20 66 6f 72 20 61 |nt..a ve|rb for a|
|00000b90| 20 6d 61 67 69 63 20 77 | 6f 72 64 3b 20 77 68 65 | magic w|ord; whe|
|00000ba0| 6e 20 74 68 65 20 6d 61 | 67 69 63 20 77 6f 72 64 |n the ma|gic word|
|00000bb0| 20 69 73 20 75 73 65 64 | 2c 20 74 68 65 20 70 6c | is used|, the pl|
|00000bc0| 61 79 65 72 20 77 69 6c | 6c 0d 0a 62 65 20 6d 61 |ayer wil|l..be ma|
|00000bd0| 67 69 63 61 6c 6c 79 20 | 74 72 61 6e 73 70 6f 72 |gically |transpor|
|00000be0| 74 65 64 20 66 72 6f 6d | 20 74 68 65 20 63 61 76 |ted from| the cav|
|00000bf0| 65 20 74 6f 20 74 68 65 | 20 73 68 61 63 6b 2c 20 |e to the| shack, |
|00000c00| 6f 72 20 74 68 65 20 73 | 68 61 63 6b 0d 0a 74 6f |or the s|hack..to|
|00000c10| 20 74 68 65 20 63 61 76 | 65 2e 0d 0a 0d 0a 7b 5c | the cav|e.....{\|
|00000c20| 65 78 61 6d 70 6c 65 0d | 0a 5c 6f 62 6a 65 63 74 |example.|.\object|
|00000c30| 7b 6d 61 67 69 63 56 65 | 72 62 3a 20 64 65 65 70 |{magicVe|rb: deep|
|00000c40| 76 65 72 62 7d 0d 0a 20 | 20 20 20 76 65 72 62 20 |verb}.. | verb |
|00000c50| 3d 20 27 78 79 7a 7a 79 | 27 0d 0a 20 20 20 20 73 |= 'xyzzy|'.. s|
|00000c60| 64 65 73 63 20 3d 20 22 | 78 79 7a 7a 79 22 0d 0a |desc = "|xyzzy"..|
|00000c70| 20 20 20 20 61 63 74 69 | 6f 6e 28 61 63 74 6f 72 | acti|on(actor|
|00000c80| 29 20 3d 0d 0a 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |) =.. | \lb.. |
|00000c90| 20 20 20 20 20 20 69 66 | 20 28 61 63 74 6f 72 2e | if| (actor.|
|00000ca0| 6c 6f 63 61 74 69 6f 6e | 20 3d 20 63 61 76 65 29 |location| = cave)|
|00000cb0| 0d 0a 20 20 20 20 20 20 | 20 20 5c 6c 62 0d 0a 20 |.. | \lb.. |
|00000cc0| 20 20 20 20 20 20 20 20 | 20 20 20 22 4f 75 74 20 | | "Out |
|00000cd0| 6f 66 20 6e 6f 77 68 65 | 72 65 2c 20 61 20 68 75 |of nowhe|re, a hu|
|00000ce0| 67 65 20 63 6c 6f 75 64 | 20 6f 66 20 6f 72 61 6e |ge cloud| of oran|
|00000cf0| 67 65 20 73 6d 6f 6b 65 | 0d 0a 20 20 20 20 20 20 |ge smoke|.. |
|00000d00| 20 20 20 20 20 20 66 69 | 6c 6c 73 20 74 68 65 20 | fi|lls the |
|00000d10| 63 61 76 65 2e 20 20 57 | 68 65 6e 20 69 74 20 63 |cave. W|hen it c|
|00000d20| 6c 65 61 72 73 2c 20 79 | 6f 75 20 73 75 64 64 65 |lears, y|ou sudde|
|00000d30| 6e 6c 79 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |nly.. | |
|00000d40| 20 72 65 61 6c 69 7a 65 | 20 74 68 61 74 20 79 6f | realize| that yo|
|00000d50| 75 27 72 65 20 69 6e 20 | 74 68 65 20 73 68 61 63 |u're in |the shac|
|00000d60| 6b 21 22 3b 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |k!";.. | |
|00000d70| 20 20 61 63 74 6f 72 2e | 6d 6f 76 65 49 6e 74 6f | actor.|moveInto|
|00000d80| 28 73 68 61 63 6b 29 3b | 0d 0a 20 20 20 20 20 20 |(shack);|.. |
|00000d90| 20 20 5c 72 62 0d 0a 20 | 20 20 20 20 20 20 20 65 | \rb.. | e|
|00000da0| 6c 73 65 20 69 66 20 28 | 61 63 74 6f 72 2e 6c 6f |lse if (|actor.lo|
|00000db0| 63 61 74 69 6f 6e 20 3d | 20 73 68 61 63 6b 29 0d |cation =| shack).|
|00000dc0| 0a 20 20 20 20 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |. | \lb.. |
|00000dd0| 20 20 20 20 20 20 20 20 | 20 20 22 59 6f 75 20 73 | | "You s|
|00000de0| 75 64 64 65 6e 6c 79 20 | 66 65 65 6c 20 76 65 72 |uddenly |feel ver|
|00000df0| 79 20 64 69 73 6f 72 69 | 65 6e 74 65 64 2c 20 61 |y disori|ented, a|
|00000e00| 6e 64 20 74 68 65 0d 0a | 20 20 20 20 20 20 20 20 |nd the..| |
|00000e10| 20 20 20 20 72 6f 6f 6d | 20 73 65 65 6d 73 20 74 | room| seems t|
|00000e20| 6f 20 62 65 20 73 70 69 | 6e 6e 69 6e 67 20 61 6c |o be spi|nning al|
|00000e30| 6c 20 61 72 6f 75 6e 64 | 20 79 6f 75 2e 20 20 41 |l around| you. A|
|00000e40| 73 20 79 6f 75 0d 0a 20 | 20 20 20 20 20 20 20 20 |s you.. | |
|00000e50| 20 20 20 67 72 61 64 75 | 61 6c 6c 79 20 72 65 67 | gradu|ally reg|
|00000e60| 61 69 6e 20 79 6f 75 72 | 20 62 61 6c 61 6e 63 65 |ain your| balance|
|00000e70| 2c 20 79 6f 75 20 72 65 | 61 6c 69 7a 65 20 74 68 |, you re|alize th|
|00000e80| 61 74 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |at.. | |
|00000e90| 79 6f 75 27 72 65 20 6e | 6f 77 20 69 6e 20 74 68 |you're n|ow in th|
|00000ea0| 65 20 63 61 76 65 21 22 | 3b 0d 0a 20 20 20 20 20 |e cave!"|;.. |
|00000eb0| 20 20 20 20 20 20 20 61 | 63 74 6f 72 2e 6d 6f 76 | a|ctor.mov|
|00000ec0| 65 49 6e 74 6f 28 63 61 | 76 65 29 3b 0d 0a 20 20 |eInto(ca|ve);.. |
|00000ed0| 20 20 20 20 20 20 5c 72 | 62 0d 0a 20 20 20 20 20 | \r|b.. |
|00000ee0| 20 20 20 65 6c 73 65 0d | 0a 20 20 20 20 20 20 20 | else.|. |
|00000ef0| 20 5c 69 6e 76 69 73 6c | 62 0d 0a 20 20 20 20 20 | \invisl|b.. |
|00000f00| 20 20 20 20 20 20 20 22 | 4e 6f 74 68 69 6e 67 20 | "|Nothing |
|00000f10| 68 61 70 70 65 6e 73 2e | 22 3b 0d 0a 20 20 20 20 |happens.|";.. |
|00000f20| 20 20 20 20 5c 69 6e 76 | 69 73 72 62 0d 0a 20 20 | \inv|isrb.. |
|00000f30| 20 20 5c 72 62 0d 0a 5c | 65 6e 64 6f 62 6a 0d 0a | \rb..\|endobj..|
|00000f40| 7d 0d 0a 0d 0a 46 6f 72 | 20 61 20 76 65 72 62 20 |}....For| a verb |
|00000f50| 74 68 61 74 20 74 61 6b | 65 73 20 61 20 5e 7b 64 |that tak|es a ^{d|
|00000f60| 69 72 65 63 74 20 6f 62 | 6a 65 63 74 7d 2c 20 74 |irect ob|ject}, t|
|00000f70| 68 65 20 76 65 72 62 20 | 6f 62 6a 65 63 74 20 69 |he verb |object i|
|00000f80| 74 73 65 6c 66 20 69 73 | 0d 0a 66 61 69 72 6c 79 |tself is|..fairly|
|00000f90| 20 73 69 6d 70 6c 65 3b | 20 61 6c 6c 20 79 6f 75 | simple;| all you|
|00000fa0| 20 6e 65 65 64 20 74 6f | 20 64 6f 20 69 73 20 64 | need to| do is d|
|00000fb0| 65 66 69 6e 65 20 7b 5c | 74 74 20 76 65 72 62 7d |efine {\|tt verb}|
|00000fc0| 20 61 6e 64 0d 0a 7b 5c | 74 74 20 73 64 65 73 63 | and..{\|tt sdesc|
|00000fd0| 7d 20 70 72 6f 70 65 72 | 74 69 65 73 2c 20 70 6c |} proper|ties, pl|
|00000fe0| 75 73 20 74 68 65 20 73 | 70 65 63 69 61 6c 20 70 |us the s|pecial p|
|00000ff0| 72 6f 70 65 72 74 79 20 | 7b 5c 74 74 20 64 6f 41 |roperty |{\tt doA|
|00001000| 63 74 69 6f 6e 7d 2e 0d | 0a 54 68 65 20 7b 5c 74 |ction}..|.The {\t|
|00001010| 74 20 64 6f 41 63 74 69 | 6f 6e 7d 20 70 72 6f 70 |t doActi|on} prop|
|00001020| 65 72 74 79 20 64 65 66 | 69 6e 65 73 20 61 20 73 |erty def|ines a s|
|00001030| 74 72 69 6e 67 20 74 68 | 61 74 20 74 68 65 20 73 |tring th|at the s|
|00001040| 79 73 74 65 6d 20 75 73 | 65 73 0d 0a 74 6f 20 66 |ystem us|es..to f|
|00001050| 6f 72 6d 20 74 68 65 20 | 6e 61 6d 65 73 20 6f 66 |orm the |names of|
|00001060| 20 74 77 6f 20 6e 65 77 | 20 70 72 6f 70 65 72 74 | two new| propert|
|00001070| 69 65 73 2e 20 20 41 73 | 20 61 6e 20 65 78 61 6d |ies. As| an exam|
|00001080| 70 6c 65 2c 20 77 65 27 | 6c 6c 0d 0a 69 6d 70 6c |ple, we'|ll..impl|
|00001090| 65 6d 65 6e 74 20 74 68 | 65 20 76 65 72 62 20 60 |ement th|e verb `|
|000010a0| 60 73 6d 65 6c 6c 2c 27 | 27 20 77 68 69 63 68 20 |`smell,'|' which |
|000010b0| 74 61 6b 65 73 20 61 73 | 20 69 74 73 20 64 69 72 |takes as| its dir|
|000010c0| 65 63 74 20 6f 62 6a 65 | 63 74 0d 0a 74 68 65 20 |ect obje|ct..the |
|000010d0| 69 74 65 6d 20 74 6f 20 | 62 65 20 73 6d 65 6c 6c |item to |be smell|
|000010e0| 65 64 2e 0d 0a 0d 0a 7b | 5c 65 78 61 6d 70 6c 65 |ed.....{|\example|
|000010f0| 0d 0a 5c 6f 62 6a 65 63 | 74 7b 73 6d 65 6c 6c 56 |..\objec|t{smellV|
|00001100| 65 72 62 3a 20 64 65 65 | 70 76 65 72 62 7d 0d 0a |erb: dee|pverb}..|
|00001110| 20 20 20 20 76 65 72 62 | 20 3d 20 27 73 6d 65 6c | verb| = 'smel|
|00001120| 6c 27 0d 0a 20 20 20 20 | 73 64 65 73 63 20 3d 20 |l'.. |sdesc = |
|00001130| 22 73 6d 65 6c 6c 22 0d | 0a 20 20 20 20 64 6f 41 |"smell".|. doA|
|00001140| 63 74 69 6f 6e 20 3d 20 | 27 53 6d 65 6c 6c 27 0d |ction = |'Smell'.|
|00001150| 0a 5c 65 6e 64 6f 62 6a | 0d 0a 7d 0d 0a 0d 0a 57 |.\endobj|..}....W|
|00001160| 68 65 6e 20 74 68 65 20 | 73 79 73 74 65 6d 20 73 |hen the |system s|
|00001170| 65 65 73 20 74 68 69 73 | 20 64 65 66 69 6e 69 74 |ees this| definit|
|00001180| 69 6f 6e 2c 20 69 74 20 | 63 72 65 61 74 65 73 20 |ion, it |creates |
|00001190| 74 77 6f 20 6e 65 77 20 | 70 72 6f 70 65 72 74 69 |two new |properti|
|000011a0| 65 73 3a 0d 0a 7b 5c 74 | 74 20 76 65 72 44 6f 53 |es:..{\t|t verDoS|
|000011b0| 6d 65 6c 6c 7d 20 61 6e | 64 20 7b 5c 74 74 20 64 |mell} an|d {\tt d|
|000011c0| 6f 53 6d 65 6c 6c 7d 2e | 20 20 4e 6f 77 2c 20 66 |oSmell}.| Now, f|
|000011d0| 6f 72 20 61 6e 79 20 6f | 62 6a 65 63 74 20 74 68 |or any o|bject th|
|000011e0| 61 74 20 74 68 65 0d 0a | 70 6c 61 79 65 72 20 63 |at the..|player c|
|000011f0| 61 6e 20 73 6d 65 6c 6c | 2c 20 79 6f 75 20 61 64 |an smell|, you ad|
|00001200| 64 20 74 68 65 20 7b 5c | 74 74 20 76 65 72 44 6f |d the {\|tt verDo|
|00001210| 53 6d 65 6c 6c 7d 20 61 | 6e 64 20 7b 5c 74 74 20 |Smell} a|nd {\tt |
|00001220| 64 6f 53 6d 65 6c 6c 7d | 0d 0a 6d 65 74 68 6f 64 |doSmell}|..method|
|00001230| 73 2e 20 20 46 6f 72 20 | 65 78 61 6d 70 6c 65 2c |s. For |example,|
|00001240| 20 77 65 27 6c 6c 20 69 | 6d 70 6c 65 6d 65 6e 74 | we'll i|mplement|
|00001250| 20 61 20 66 6c 6f 77 65 | 72 20 28 6e 6f 74 69 63 | a flowe|r (notic|
|00001260| 65 20 74 68 61 74 20 77 | 65 0d 0a 64 65 66 74 6c |e that w|e..deftl|
|00001270| 79 20 62 79 70 61 73 73 | 20 74 68 65 20 6f 70 70 |y bypass| the opp|
|00001280| 6f 72 74 75 6e 69 74 79 | 20 66 6f 72 20 61 20 63 |ortunity| for a c|
|00001290| 68 65 61 70 20 6a 6f 6b | 65 20 68 65 72 65 20 61 |heap jok|e here a|
|000012a0| 74 20 74 68 65 20 65 78 | 70 65 6e 73 65 0d 0a 6f |t the ex|pense..o|
|000012b0| 66 20 67 6f 6f 64 20 74 | 61 73 74 65 20 62 79 20 |f good t|aste by |
|000012c0| 63 68 6f 6f 73 69 6e 67 | 20 61 6e 20 6f 62 6a 65 |choosing| an obje|
|000012d0| 63 74 20 77 69 74 68 20 | 61 20 6e 6f 6e 2d 6f 66 |ct with |a non-of|
|000012e0| 66 65 6e 73 69 76 65 20 | 6f 64 6f 72 29 3a 0d 0a |fensive |odor):..|
|000012f0| 0d 0a 7b 5c 65 78 61 6d | 70 6c 65 0d 0a 5c 6f 62 |..{\exam|ple..\ob|
|00001300| 6a 65 63 74 7b 66 6c 6f | 77 65 72 3a 20 69 74 65 |ject{flo|wer: ite|
|00001310| 6d 7d 0d 0a 20 20 20 20 | 6e 6f 75 6e 20 3d 20 27 |m}.. |noun = '|
|00001320| 66 6c 6f 77 65 72 27 20 | 27 72 6f 73 65 27 0d 0a |flower' |'rose'..|
|00001330| 20 20 20 20 61 64 6a 65 | 63 74 69 76 65 20 3d 20 | adje|ctive = |
|00001340| 27 72 65 64 27 0d 0a 20 | 20 20 20 73 64 65 73 63 |'red'.. | sdesc|
|00001350| 20 3d 20 22 72 65 64 20 | 72 6f 73 65 22 0d 0a 20 | = "red |rose".. |
|00001360| 20 20 20 6c 64 65 73 63 | 20 3d 20 22 49 74 27 73 | ldesc| = "It's|
|00001370| 20 61 20 72 65 64 20 72 | 6f 73 65 2e 22 0d 0a 20 | a red r|ose.".. |
|00001380| 20 20 20 76 65 72 44 6f | 53 6d 65 6c 6c 28 61 63 | verDo|Smell(ac|
|00001390| 74 6f 72 29 20 3d 0d 0a | 20 20 20 20 5c 6c 62 0d |tor) =..| \lb.|
|000013a0| 0a 20 20 20 20 5c 72 62 | 0d 0a 20 20 20 20 64 6f |. \rb|.. do|
|000013b0| 53 6d 65 6c 6c 28 61 63 | 74 6f 72 29 20 3d 0d 0a |Smell(ac|tor) =..|
|000013c0| 20 20 20 20 5c 6c 62 0d | 0a 20 20 20 20 20 20 20 | \lb.|. |
|000013d0| 20 22 41 20 72 6f 73 65 | 20 62 79 20 61 6e 79 20 | "A rose| by any |
|000013e0| 6f 74 68 65 72 20 6e 61 | 6d 65 2e 2e 2e 22 3b 0d |other na|me...";.|
|000013f0| 0a 20 20 20 20 5c 72 62 | 0d 0a 5c 65 6e 64 6f 62 |. \rb|..\endob|
|00001400| 6a 0d 0a 7d 0d 0a 0d 0a | 5e 5e 7b 64 6f 41 63 74 |j..}....|^^{doAct|
|00001410| 69 6f 6e 7d 0d 0a 49 66 | 20 74 68 65 20 7b 5c 74 |ion}..If| the {\t|
|00001420| 74 20 76 65 72 44 6f 53 | 6d 65 6c 6c 7d 20 6d 65 |t verDoS|mell} me|
|00001430| 74 68 6f 64 20 69 73 6e | 27 74 20 64 65 66 69 6e |thod isn|'t defin|
|00001440| 65 64 20 66 6f 72 20 61 | 6e 20 6f 62 6a 65 63 74 |ed for a|n object|
|00001450| 2c 0d 0a 74 72 79 69 6e | 67 20 74 6f 20 73 6d 65 |,..tryin|g to sme|
|00001460| 6c 6c 20 69 74 20 77 69 | 6c 6c 20 63 61 75 73 65 |ll it wi|ll cause|
|00001470| 20 74 68 65 20 73 79 73 | 74 65 6d 20 74 6f 20 64 | the sys|tem to d|
|00001480| 69 73 70 6c 61 79 20 74 | 68 65 20 6d 65 73 73 61 |isplay t|he messa|
|00001490| 67 65 0d 0a 60 60 49 20 | 64 6f 6e 27 74 20 6b 6e |ge..``I |don't kn|
|000014a0| 6f 77 20 68 6f 77 20 74 | 6f 20 73 6d 65 6c 6c 20 |ow how t|o smell |
|000014b0| 74 68 65 20 7b 5c 69 74 | 20 6f 62 6a 65 63 74 7d |the {\it| object}|
|000014c0| 2e 27 27 0d 0a 53 69 6e | 63 65 20 60 60 73 6d 65 |.''..Sin|ce ``sme|
|000014d0| 6c 6c 27 27 20 69 73 20 | 61 20 76 65 72 62 20 74 |ll'' is |a verb t|
|000014e0| 68 61 74 20 79 6f 75 20 | 6d 61 79 20 77 61 6e 74 |hat you |may want|
|000014f0| 20 74 6f 20 61 6c 6c 6f | 77 20 66 6f 72 20 65 76 | to allo|w for ev|
|00001500| 65 72 79 0d 0a 6f 62 6a | 65 63 74 20 69 6e 20 79 |ery..obj|ect in y|
|00001510| 6f 75 72 20 67 61 6d 65 | 2c 20 79 6f 75 20 6d 61 |our game|, you ma|
|00001520| 79 20 77 61 6e 74 20 74 | 6f 20 6d 6f 64 69 66 79 |y want t|o modify|
|00001530| 20 74 68 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 20 | the def|inition |
|00001540| 6f 66 0d 0a 7b 5c 74 74 | 20 74 68 69 6e 67 7d 20 |of..{\tt| thing} |
|00001550| 69 6e 20 7b 5c 74 74 20 | 61 64 76 2e 74 7d 20 74 |in {\tt |adv.t} t|
|00001560| 6f 20 70 72 6f 76 69 64 | 65 20 61 20 62 65 74 74 |o provid|e a bett|
|00001570| 65 72 20 64 65 66 61 75 | 6c 74 20 6d 65 73 73 61 |er defau|lt messa|
|00001580| 67 65 0d 0a 66 6f 72 20 | 74 68 69 73 20 76 65 72 |ge..for |this ver|
|00001590| 62 2e 20 20 59 6f 75 20 | 63 6f 75 6c 64 20 61 64 |b. You |could ad|
|000015a0| 64 20 74 68 65 73 65 20 | 6c 69 6e 65 73 20 74 6f |d these |lines to|
|000015b0| 20 74 68 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 20 | the def|inition |
|000015c0| 6f 66 0d 0a 7b 5c 74 74 | 20 74 68 69 6e 67 7d 20 |of..{\tt| thing} |
|000015d0| 69 6e 20 7b 5c 74 74 20 | 61 64 76 2e 74 7d 3a 0d |in {\tt |adv.t}:.|
|000015e0| 0a 0d 0a 7b 5c 65 78 61 | 6d 70 6c 65 0d 0a 76 65 |...{\exa|mple..ve|
|000015f0| 72 44 6f 53 6d 65 6c 6c | 28 61 63 74 6f 72 29 20 |rDoSmell|(actor) |
|00001600| 3d 0d 0a 5c 6c 62 0d 0a | 5c 72 62 0d 0a 64 6f 53 |=..\lb..|\rb..doS|
|00001610| 6d 65 6c 6c 28 61 63 74 | 6f 72 29 20 3d 0d 0a 5c |mell(act|or) =..\|
|00001620| 6c 62 0d 0a 20 20 20 20 | 22 49 74 20 73 6d 65 6c |lb.. |"It smel|
|00001630| 6c 73 20 6c 69 6b 65 20 | 61 6e 79 20 6f 74 68 65 |ls like |any othe|
|00001640| 72 20 3c 3c 73 65 6c 66 | 2e 73 64 65 73 63 3e 3e |r <<self|.sdesc>>|
|00001650| 2e 22 3b 0d 0a 5c 72 62 | 0d 0a 7d 0d 0a 0d 0a 49 |.";..\rb|..}....I|
|00001660| 66 20 79 6f 75 20 64 6f | 20 74 68 69 73 2c 20 61 |f you do| this, a|
|00001670| 6c 6c 20 79 6f 75 20 6e | 65 65 64 20 74 6f 20 64 |ll you n|eed to d|
|00001680| 6f 20 69 73 20 6f 76 65 | 72 72 69 64 65 20 74 68 |o is ove|rride th|
|00001690| 65 20 7b 5c 74 74 20 64 | 6f 53 6d 65 6c 6c 7d 0d |e {\tt d|oSmell}.|
|000016a0| 0a 6d 65 74 68 6f 64 20 | 66 6f 72 20 61 6e 79 20 |.method |for any |
|000016b0| 6f 62 6a 65 63 74 20 77 | 69 74 68 20 61 20 6e 6f |object w|ith a no|
|000016c0| 6e 2d 64 65 66 61 75 6c | 74 20 6f 64 6f 72 2e 0d |n-defaul|t odor..|
|000016d0| 0a 0d 0a 5e 5e 7b 69 6f | 41 63 74 69 6f 6e 7d 0d |...^^{io|Action}.|
|000016e0| 0a 41 64 64 69 6e 67 20 | 61 20 76 65 72 62 20 74 |.Adding |a verb t|
|000016f0| 68 61 74 20 74 61 6b 65 | 73 20 74 77 6f 20 6f 62 |hat take|s two ob|
|00001700| 6a 65 63 74 73 20 28 61 | 20 64 69 72 65 63 74 20 |jects (a| direct |
|00001710| 6f 62 6a 65 63 74 20 70 | 6c 75 73 20 61 6e 0d 0a |object p|lus an..|
|00001720| 5e 7b 69 6e 64 69 72 65 | 63 74 20 6f 62 6a 65 63 |^{indire|ct objec|
|00001730| 74 7d 29 20 69 73 20 73 | 69 6d 69 6c 61 72 2e 20 |t}) is s|imilar. |
|00001740| 20 52 61 74 68 65 72 20 | 74 68 61 6e 20 64 65 66 | Rather |than def|
|00001750| 69 6e 69 6e 67 20 61 20 | 7b 5c 74 74 20 64 6f 41 |ining a |{\tt doA|
|00001760| 63 74 69 6f 6e 7d 0d 0a | 70 72 6f 70 65 72 74 79 |ction}..|property|
|00001770| 2c 20 79 6f 75 20 64 65 | 66 69 6e 65 20 61 6e 20 |, you de|fine an |
|00001780| 7b 5c 74 74 20 69 6f 41 | 63 74 69 6f 6e 28 7b 5c |{\tt ioA|ction({\|
|00001790| 69 74 20 70 72 65 70 6f | 73 69 74 69 6f 6e 7d 29 |it prepo|sition})|
|000017a0| 7d 20 70 72 6f 70 65 72 | 74 79 2e 0d 0a 46 6f 72 |} proper|ty...For|
|000017b0| 20 65 78 61 6d 70 6c 65 | 2c 20 73 75 70 70 6f 73 | example|, suppos|
|000017c0| 65 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 69 6d |e you wa|nt to im|
|000017d0| 70 6c 65 6d 65 6e 74 20 | 61 20 76 65 72 62 20 60 |plement |a verb `|
|000017e0| 60 70 72 79 20 7b 5c 69 | 74 20 64 69 72 65 63 74 |`pry {\i|t direct|
|000017f0| 2d 6f 62 6a 65 63 74 7d | 0d 0a 77 69 74 68 20 7b |-object}|..with {|
|00001800| 5c 69 74 20 69 6e 64 69 | 72 65 63 74 2d 6f 62 6a |\it indi|rect-obj|
|00001810| 65 63 74 7d 27 27 3a 0d | 0a 0d 0a 7b 5c 65 78 61 |ect}'':.|...{\exa|
|00001820| 6d 70 6c 65 0d 0a 5c 6f | 62 6a 65 63 74 7b 70 72 |mple..\o|bject{pr|
|00001830| 79 56 65 72 62 3a 20 64 | 65 65 70 76 65 72 62 7d |yVerb: d|eepverb}|
|00001840| 0d 0a 20 20 20 20 76 65 | 72 62 20 3d 20 27 70 72 |.. ve|rb = 'pr|
|00001850| 79 27 0d 0a 20 20 20 20 | 73 64 65 73 63 20 3d 20 |y'.. |sdesc = |
|00001860| 22 70 72 79 22 0d 0a 20 | 20 20 20 69 6f 41 63 74 |"pry".. | ioAct|
|00001870| 69 6f 6e 28 77 69 74 68 | 50 72 65 70 29 20 3d 20 |ion(with|Prep) = |
|00001880| 27 50 72 79 57 69 74 68 | 27 0d 0a 20 20 20 20 70 |'PryWith|'.. p|
|00001890| 72 65 70 44 65 66 61 75 | 6c 74 20 3d 20 77 69 74 |repDefau|lt = wit|
|000018a0| 68 50 72 65 70 0d 0a 5c | 65 6e 64 6f 62 6a 0d 0a |hPrep..\|endobj..|
|000018b0| 7d 0d 0a 0d 0a 54 68 69 | 73 20 63 61 75 73 65 73 |}....Thi|s causes|
|000018c0| 20 74 68 65 20 73 79 73 | 74 65 6d 20 74 6f 20 63 | the sys|tem to c|
|000018d0| 72 65 61 74 65 20 74 68 | 65 20 70 72 6f 70 65 72 |reate th|e proper|
|000018e0| 74 69 65 73 20 7b 5c 74 | 74 20 76 65 72 49 6f 50 |ties {\t|t verIoP|
|000018f0| 72 79 57 69 74 68 7d 2c | 0d 0a 7b 5c 74 74 20 76 |ryWith},|..{\tt v|
|00001900| 65 72 44 6f 50 72 79 57 | 69 74 68 7d 2c 20 61 6e |erDoPryW|ith}, an|
|00001910| 64 20 7b 5c 74 74 20 69 | 6f 50 72 79 57 69 74 68 |d {\tt i|oPryWith|
|00001920| 7d 2c 20 77 68 69 63 68 | 20 74 68 65 20 73 79 73 |}, which| the sys|
|00001930| 74 65 6d 20 77 69 6c 6c | 0d 0a 63 61 6c 6c 20 69 |tem will|..call i|
|00001940| 6e 20 74 68 61 74 20 6f | 72 64 65 72 20 28 7b 5c |n that o|rder ({\|
|00001950| 74 74 20 76 65 72 44 6f | 50 72 79 57 69 74 68 7d |tt verDo|PryWith}|
|00001960| 20 69 73 20 63 61 6c 6c | 65 64 20 66 6f 72 20 74 | is call|ed for t|
|00001970| 68 65 20 64 69 72 65 63 | 74 0d 0a 6f 62 6a 65 63 |he direc|t..objec|
|00001980| 74 2c 20 61 6e 64 20 74 | 68 65 20 6f 74 68 65 72 |t, and t|he other|
|00001990| 20 74 77 6f 20 61 72 65 | 20 63 61 6c 6c 65 64 20 | two are| called |
|000019a0| 66 6f 72 20 74 68 65 20 | 69 6e 64 69 72 65 63 74 |for the |indirect|
|000019b0| 20 6f 62 6a 65 63 74 2e | 29 0d 0a 4e 6f 74 65 20 | object.|)..Note |
|000019c0| 74 68 61 74 20 77 65 27 | 76 65 20 61 6c 73 6f 20 |that we'|ve also |
|000019d0| 64 65 66 69 6e 65 64 20 | 61 20 64 65 66 61 75 6c |defined |a defaul|
|000019e0| 74 20 70 72 65 70 6f 73 | 69 74 69 6f 6e 3b 20 77 |t prepos|ition; w|
|000019f0| 68 69 6c 65 20 74 68 69 | 73 0d 0a 69 73 6e 27 74 |hile thi|s..isn't|
|00001a00| 20 72 65 71 75 69 72 65 | 64 2c 20 69 74 20 61 6c | require|d, it al|
|00001a10| 6c 6f 77 73 20 74 68 65 | 20 73 79 73 74 65 6d 20 |lows the| system |
|00001a20| 74 6f 20 62 65 20 73 6d | 61 72 74 65 72 20 62 79 |to be sm|arter by|
|00001a30| 20 67 75 65 73 73 69 6e | 67 0d 0a 77 68 61 74 20 | guessin|g..what |
|00001a40| 74 68 65 20 70 6c 61 79 | 65 72 20 6d 65 61 6e 74 |the play|er meant|
|00001a50| 20 77 68 65 6e 20 73 6f | 6d 65 20 77 6f 72 64 73 | when so|me words|
|00001a60| 20 61 72 65 20 6c 65 66 | 74 20 6f 75 74 2e 20 20 | are lef|t out. |
|00001a70| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 0d 0a 69 66 |For exam|ple,..if|
|00001a80| 20 74 68 65 20 6f 6e 6c | 79 20 6f 62 6a 65 63 74 | the onl|y object|
|00001a90| 20 70 72 65 73 65 6e 74 | 20 74 68 61 74 20 63 61 | present| that ca|
|00001aa0| 6e 20 62 65 20 75 73 65 | 64 20 61 73 20 61 6e 20 |n be use|d as an |
|00001ab0| 69 6e 64 69 72 65 63 74 | 20 6f 62 6a 65 63 74 0d |indirect| object.|
|00001ac0| 0a 69 6e 20 74 68 65 20 | 60 60 70 72 79 27 27 20 |.in the |``pry'' |
|00001ad0| 63 6f 6d 6d 61 6e 64 20 | 69 73 20 61 20 63 72 6f |command |is a cro|
|00001ae0| 77 20 62 61 72 2c 20 74 | 68 65 20 73 79 73 74 65 |w bar, t|he syste|
|00001af0| 6d 20 63 61 6e 20 70 72 | 6f 76 69 64 65 20 74 68 |m can pr|ovide th|
|00001b00| 65 0d 0a 60 60 77 69 74 | 68 20 74 68 65 20 63 72 |e..``wit|h the cr|
|00001b10| 6f 77 20 62 61 72 27 27 | 20 70 68 72 61 73 65 20 |ow bar''| phrase |
|00001b20| 62 79 20 64 65 66 61 75 | 6c 74 20 77 68 65 6e 20 |by defau|lt when |
|00001b30| 74 68 65 20 70 6c 61 79 | 65 72 20 73 69 6d 70 6c |the play|er simpl|
|00001b40| 79 0d 0a 74 79 70 65 73 | 20 60 60 70 72 79 20 74 |y..types| ``pry t|
|00001b50| 68 65 20 64 6f 6f 72 2e | 27 27 0d 0a 0d 0a 57 68 |he door.|''....Wh|
|00001b60| 65 74 68 65 72 20 6f 72 | 20 6e 6f 74 20 79 6f 75 |ether or| not you|
|00001b70| 20 61 64 64 20 76 65 72 | 62 73 20 74 6f 20 74 68 | add ver|bs to th|
|00001b80| 65 20 62 61 73 69 63 20 | 73 65 74 20 69 6e 20 7b |e basic |set in {|
|00001b90| 5c 74 74 20 61 64 76 2e | 74 7d 2c 20 69 74 27 73 |\tt adv.|t}, it's|
|00001ba0| 0d 0a 61 20 67 6f 6f 64 | 20 69 64 65 61 20 74 6f |..a good| idea to|
|00001bb0| 20 64 6f 63 75 6d 65 6e | 74 20 79 6f 75 72 20 76 | documen|t your v|
|00001bc0| 65 72 62 73 2e 20 20 49 | 6e 20 74 68 65 20 69 6e |erbs. I|n the in|
|00001bd0| 73 74 72 75 63 74 69 6f | 6e 73 20 66 6f 72 20 79 |structio|ns for y|
|00001be0| 6f 75 72 20 67 61 6d 65 | 2c 0d 0a 79 6f 75 20 73 |our game|,..you s|
|00001bf0| 68 6f 75 6c 64 20 70 72 | 6f 76 69 64 65 20 61 20 |hould pr|ovide a |
|00001c00| 6c 69 73 74 20 6f 66 20 | 61 6c 6c 20 6f 66 20 74 |list of |all of t|
|00001c10| 68 65 20 76 65 72 62 73 | 20 74 68 61 74 20 61 72 |he verbs| that ar|
|00001c20| 65 20 6e 65 65 64 65 64 | 20 74 6f 20 63 6f 6d 70 |e needed| to comp|
|00001c30| 6c 65 74 65 0d 0a 74 68 | 65 20 67 61 6d 65 2e 20 |lete..th|e game. |
|00001c40| 20 49 66 20 70 6c 61 79 | 65 72 73 20 67 65 74 73 | If play|ers gets|
|00001c50| 20 73 74 75 63 6b 2c 20 | 74 68 69 73 20 6c 69 73 | stuck, |this lis|
|00001c60| 74 20 63 61 6e 20 62 65 | 20 68 65 6c 70 66 75 6c |t can be| helpful|
|00001c70| 20 69 6e 0d 0a 63 6f 6e | 76 69 6e 63 69 6e 67 20 | in..con|vincing |
|00001c80| 74 68 65 6d 20 74 68 61 | 74 20 74 68 65 79 27 72 |them tha|t they'r|
|00001c90| 65 20 6e 6f 74 20 66 69 | 67 68 74 69 6e 67 20 74 |e not fi|ghting t|
|00001ca0| 68 65 20 70 61 72 73 65 | 72 2e 0d 0a 0d 0a 0d 0a |he parse|r.......|
|00001cb0| 5c 6d 61 6a 6f 72 73 65 | 63 74 69 6f 6e 7b 43 6f |\majorse|ction{Co|
|00001cc0| 6d 70 6c 65 78 20 52 6f | 6f 6d 20 49 6e 74 65 72 |mplex Ro|om Inter|
|00001cd0| 63 6f 6e 6e 65 63 74 69 | 6f 6e 73 7d 0d 0a 0d 0a |connecti|ons}....|
|00001ce0| 5e 5e 7b 72 6f 6f 6d 73 | 7d 0d 0a 54 68 65 20 62 |^^{rooms|}..The b|
|00001cf0| 61 73 69 63 20 5e 7b 74 | 72 61 76 65 6c 7d 20 72 |asic ^{t|ravel} r|
|00001d00| 6f 75 74 69 6e 65 73 20 | 75 73 65 64 20 62 79 20 |outines |used by |
|00001d10| 7b 5c 74 74 20 61 64 76 | 2e 74 7d 20 6d 61 6b 65 |{\tt adv|.t} make|
|00001d20| 20 69 74 20 65 61 73 79 | 20 74 6f 0d 0a 69 6d 70 | it easy| to..imp|
|00001d30| 6c 65 6d 65 6e 74 20 61 | 20 62 61 73 69 63 20 5e |lement a| basic ^|
|00001d40| 7b 6d 61 70 7d 3a 20 20 | 61 6c 6c 20 79 6f 75 20 |{map}: |all you |
|00001d50| 68 61 76 65 20 74 6f 20 | 64 6f 20 69 6e 20 79 6f |have to |do in yo|
|00001d60| 75 72 20 64 65 66 69 6e | 69 74 69 6f 6e 73 0d 0a |ur defin|itions..|
|00001d70| 69 73 20 74 6f 20 70 72 | 6f 76 69 64 65 20 70 72 |is to pr|ovide pr|
|00001d80| 6f 70 65 72 74 69 65 73 | 20 77 69 74 68 20 6e 61 |operties| with na|
|00001d90| 6d 65 73 20 6c 69 6b 65 | 20 7b 5c 74 74 20 6e 6f |mes like| {\tt no|
|00001da0| 72 74 68 7d 20 61 6e 64 | 20 7b 5c 74 74 20 73 6f |rth} and| {\tt so|
|00001db0| 75 74 68 7d 2c 0d 0a 61 | 6e 64 20 73 65 74 20 74 |uth},..a|nd set t|
|00001dc0| 68 65 6d 20 74 6f 20 70 | 6f 69 6e 74 20 74 6f 20 |hem to p|oint to |
|00001dd0| 72 6f 6f 6d 73 2c 20 73 | 69 6d 70 6c 79 20 62 79 |rooms, s|imply by|
|00001de0| 20 6e 61 6d 69 6e 67 20 | 74 68 65 20 72 6f 6f 6d | naming |the room|
|00001df0| 3a 0d 0a 0d 0a 7b 5c 65 | 78 61 6d 70 6c 65 0d 0a |:....{\e|xample..|
|00001e00| 5c 6f 62 6a 65 63 74 7b | 6b 69 74 63 68 65 6e 3a |\object{|kitchen:|
|00001e10| 20 72 6f 6f 6d 7d 0d 0a | 20 20 20 20 6e 6f 72 74 | room}..| nort|
|00001e20| 68 20 3d 20 68 61 6c 6c | 77 61 79 0d 0a 20 20 20 |h = hall|way.. |
|00001e30| 20 65 61 73 74 20 3d 20 | 70 6f 72 63 68 0d 0a 5c | east = |porch..\|
|00001e40| 65 6e 64 6f 62 6a 0d 0a | 7d 0d 0a 0d 0a 54 68 69 |endobj..|}....Thi|
|00001e50| 73 20 69 73 20 66 69 6e | 65 20 66 6f 72 20 6d 6f |s is fin|e for mo|
|00001e60| 73 74 20 73 69 74 75 61 | 74 69 6f 6e 73 2c 20 62 |st situa|tions, b|
|00001e70| 75 74 20 66 72 65 71 75 | 65 6e 74 6c 79 20 79 6f |ut frequ|ently yo|
|00001e80| 75 27 6c 6c 20 77 61 6e | 74 20 73 6f 6d 65 74 68 |u'll wan|t someth|
|00001e90| 69 6e 67 0d 0a 74 6f 20 | 68 61 70 70 65 6e 20 64 |ing..to |happen d|
|00001ea0| 75 72 69 6e 67 20 74 72 | 61 76 65 6c 20 74 68 61 |uring tr|avel tha|
|00001eb0| 74 27 73 20 6d 6f 72 65 | 20 63 6f 6d 70 6c 69 63 |t's more| complic|
|00001ec0| 61 74 65 64 20 74 68 61 | 6e 20 73 69 6d 70 6c 79 |ated tha|n simply|
|00001ed0| 20 6d 6f 76 69 6e 67 0d | 0a 74 68 65 20 70 6c 61 | moving.|.the pla|
|00001ee0| 79 65 72 20 74 6f 20 74 | 68 65 20 67 69 76 65 6e |yer to t|he given|
|00001ef0| 20 72 6f 6f 6d 2e 20 20 | 46 6f 72 20 65 78 61 6d | room. |For exam|
|00001f00| 70 6c 65 2c 20 69 66 20 | 79 6f 75 20 68 61 76 65 |ple, if |you have|
|00001f10| 20 61 20 76 65 72 79 20 | 6c 6f 6e 67 0d 0a 68 61 | a very |long..ha|
|00001f20| 6c 6c 77 61 79 2c 20 79 | 6f 75 20 6d 61 79 20 77 |llway, y|ou may w|
|00001f30| 61 6e 74 20 61 20 73 70 | 65 63 69 61 6c 20 6d 65 |ant a sp|ecial me|
|00001f40| 73 73 61 67 65 20 74 6f | 20 62 65 20 64 69 73 70 |ssage to| be disp|
|00001f50| 6c 61 79 65 64 20 77 68 | 65 6e 20 74 72 61 76 65 |layed wh|en trave|
|00001f60| 6c 6c 69 6e 67 0d 0a 74 | 6f 20 69 6e 64 69 63 61 |lling..t|o indica|
|00001f70| 74 65 20 74 68 61 74 20 | 74 68 65 20 77 61 6c 6b |te that |the walk|
|00001f80| 20 77 61 73 20 65 73 70 | 65 63 69 61 6c 6c 79 20 | was esp|ecially |
|00001f90| 6c 6f 6e 67 2e 20 20 4f | 72 2c 20 79 6f 75 20 6d |long. O|r, you m|
|00001fa0| 61 79 20 77 61 6e 74 20 | 74 6f 0d 0a 73 65 74 20 |ay want |to..set |
|00001fb0| 6f 66 66 20 61 20 74 72 | 61 70 20 77 68 65 6e 20 |off a tr|ap when |
|00001fc0| 74 68 65 20 70 6c 61 79 | 65 72 20 74 61 6b 65 73 |the play|er takes|
|00001fd0| 20 61 20 63 65 72 74 61 | 69 6e 20 65 78 69 74 2e | a certa|in exit.|
|00001fe0| 20 20 4f 72 2c 20 79 6f | 75 20 6d 61 79 20 77 61 | Or, yo|u may wa|
|00001ff0| 6e 74 0d 0a 74 6f 20 70 | 72 65 76 65 6e 74 20 74 |nt..to p|revent t|
|00002000| 72 61 76 65 6c 20 69 6e | 20 61 20 70 61 72 74 69 |ravel in| a parti|
|00002010| 63 75 6c 61 72 20 64 69 | 72 65 63 74 69 6f 6e 20 |cular di|rection |
|00002020| 75 6e 74 69 6c 20 61 20 | 64 6f 6f 72 20 68 61 73 |until a |door has|
|00002030| 20 62 65 65 6e 0d 0a 6f | 70 65 6e 65 64 20 6f 72 | been..o|pened or|
|00002040| 20 73 6f 6d 65 20 6f 74 | 68 65 72 20 6f 62 73 74 | some ot|her obst|
|00002050| 61 63 6c 65 20 68 61 73 | 20 62 65 65 6e 20 72 65 |acle has| been re|
|00002060| 6d 6f 76 65 64 2e 0d 0a | 0d 0a 54 68 65 20 62 61 |moved...|..The ba|
|00002070| 73 69 63 20 74 72 69 63 | 6b 20 74 6f 20 69 6d 70 |sic tric|k to imp|
|00002080| 6c 65 6d 65 6e 74 69 6e | 67 20 73 70 65 63 69 61 |lementin|g specia|
|00002090| 6c 20 74 72 61 76 65 6c | 20 65 66 66 65 63 74 73 |l travel| effects|
|000020a0| 20 6c 69 6b 65 20 74 68 | 65 73 65 0d 0a 69 73 20 | like th|ese..is |
|000020b0| 74 6f 20 72 65 61 6c 69 | 7a 65 20 74 68 61 74 20 |to reali|ze that |
|000020c0| 74 68 65 20 64 69 72 65 | 63 74 69 6f 6e 20 70 72 |the dire|ction pr|
|000020d0| 6f 70 65 72 74 69 65 73 | 20 6f 66 20 61 20 72 6f |operties| of a ro|
|000020e0| 6f 6d 20 61 72 65 6e 27 | 74 0d 0a 6c 69 6d 69 74 |om aren'|t..limit|
|000020f0| 65 64 20 74 6f 20 73 69 | 6d 70 6c 65 20 72 6f 6f |ed to si|mple roo|
|00002100| 6d 20 70 6f 69 6e 74 65 | 72 73 2d 2d 2d 79 6f 75 |m pointe|rs---you|
|00002110| 20 63 61 6e 20 77 72 69 | 74 65 20 61 20 6d 65 74 | can wri|te a met|
|00002120| 68 6f 64 20 69 6e 73 74 | 65 61 64 2e 0d 0a 41 73 |hod inst|ead...As|
|00002130| 20 6c 6f 6e 67 20 61 73 | 20 79 6f 75 20 66 6f 6c | long as| you fol|
|00002140| 6c 6f 77 20 61 20 66 65 | 77 20 73 69 6d 70 6c 65 |low a fe|w simple|
|00002150| 20 72 75 6c 65 73 2c 20 | 79 6f 75 20 63 61 6e 20 | rules, |you can |
|00002160| 64 6f 20 77 68 61 74 65 | 76 65 72 20 79 6f 75 0d |do whate|ver you.|
|00002170| 0a 77 61 6e 74 20 69 6e | 20 74 68 69 73 20 6d 65 |.want in| this me|
|00002180| 74 68 6f 64 2e 20 20 42 | 61 73 69 63 61 6c 6c 79 |thod. B|asically|
|00002190| 2c 20 69 66 20 79 6f 75 | 20 77 61 6e 74 20 6e 6f |, if you| want no|
|000021a0| 72 6d 61 6c 20 74 72 61 | 76 65 6c 20 74 6f 0d 0a |rmal tra|vel to..|
|000021b0| 6f 63 63 75 72 20 61 66 | 74 65 72 20 74 68 65 20 |occur af|ter the |
|000021c0| 6d 65 74 68 6f 64 20 69 | 73 20 66 69 6e 69 73 68 |method i|s finish|
|000021d0| 65 64 2c 20 74 68 65 20 | 6d 65 74 68 6f 64 20 73 |ed, the |method s|
|000021e0| 68 6f 75 6c 64 20 72 65 | 74 75 72 6e 20 61 0d 0a |hould re|turn a..|
|000021f0| 72 6f 6f 6d 20 6f 62 6a | 65 63 74 20 77 68 69 63 |room obj|ect whic|
|00002200| 68 20 69 6e 64 69 63 61 | 74 65 73 20 74 68 65 20 |h indica|tes the |
|00002210| 64 65 73 74 69 6e 61 74 | 69 6f 6e 20 6f 66 20 74 |destinat|ion of t|
|00002220| 68 65 20 74 72 61 76 65 | 6c 2e 20 20 49 66 0d 0a |he trave|l. If..|
|00002230| 79 6f 75 20 64 6f 6e 27 | 74 20 77 61 6e 74 20 61 |you don'|t want a|
|00002240| 6e 79 74 68 69 6e 67 20 | 6d 6f 72 65 20 74 6f 20 |nything |more to |
|00002250| 68 61 70 70 65 6e 20 61 | 66 74 65 72 20 74 68 65 |happen a|fter the|
|00002260| 20 6d 65 74 68 6f 64 20 | 69 73 20 66 69 6e 69 73 | method |is finis|
|00002270| 68 65 64 2c 0d 0a 74 68 | 65 20 6d 65 74 68 6f 64 |hed,..th|e method|
|00002280| 20 73 68 6f 75 6c 64 20 | 72 65 74 75 72 6e 20 7b | should |return {|
|00002290| 5c 74 74 20 6e 69 6c 7d | 2e 20 20 54 68 65 20 66 |\tt nil}|. The f|
|000022a0| 6f 6c 6c 6f 77 69 6e 67 | 20 73 65 63 74 69 6f 6e |ollowing| section|
|000022b0| 73 20 73 68 6f 77 0d 0a | 68 6f 77 20 74 6f 20 75 |s show..|how to u|
|000022c0| 73 65 20 64 69 72 65 63 | 74 69 6f 6e 20 6d 65 74 |se direc|tion met|
|000022d0| 68 6f 64 73 20 74 6f 20 | 69 6d 70 6c 65 6d 65 6e |hods to |implemen|
|000022e0| 74 20 61 20 76 61 72 69 | 65 74 79 20 6f 66 20 73 |t a vari|ety of s|
|000022f0| 70 65 63 69 61 6c 0d 0a | 74 72 61 76 65 6c 20 65 |pecial..|travel e|
|00002300| 66 66 65 63 74 73 2e 0d | 0a 0d 0a 5c 6d 69 6e 6f |ffects..|...\mino|
|00002310| 72 73 65 63 74 69 6f 6e | 7b 44 69 73 70 6c 61 79 |rsection|{Display|
|00002320| 20 61 20 4d 65 73 73 61 | 67 65 20 44 75 72 69 6e | a Messa|ge Durin|
|00002330| 67 20 54 72 61 76 65 6c | 7d 0d 0a 0d 0a 4f 6e 65 |g Travel|}....One|
|00002340| 20 6f 66 20 74 68 65 20 | 73 69 6d 70 6c 65 73 74 | of the |simplest|
|00002350| 20 73 70 65 63 69 61 6c | 20 65 66 66 65 63 74 73 | special| effects|
|00002360| 20 69 73 20 64 69 73 70 | 6c 61 79 69 6e 67 20 61 | is disp|laying a|
|00002370| 20 6d 65 73 73 61 67 65 | 20 64 75 72 69 6e 67 0d | message| during.|
|00002380| 0a 74 72 61 76 65 6c 2e | 20 20 46 6f 72 20 65 78 |.travel.| For ex|
|00002390| 61 6d 70 6c 65 2c 20 73 | 75 70 70 6f 73 65 20 79 |ample, s|uppose y|
|000023a0| 6f 75 20 68 61 76 65 20 | 61 20 73 74 61 69 72 77 |ou have |a stairw|
|000023b0| 61 79 20 6c 65 61 64 69 | 6e 67 20 64 6f 77 6e 2c |ay leadi|ng down,|
|000023c0| 0d 0a 62 75 74 20 74 68 | 65 20 73 74 61 69 72 73 |..but th|e stairs|
|000023d0| 20 63 6f 6c 6c 61 70 73 | 65 20 77 68 69 6c 65 20 | collaps|e while |
|000023e0| 74 68 65 20 70 6c 61 79 | 65 72 20 69 73 20 64 65 |the play|er is de|
|000023f0| 73 63 65 6e 64 69 6e 67 | 20 74 68 65 6d 2c 0d 0a |scending| them,..|
|00002400| 64 72 6f 70 70 69 6e 67 | 20 74 68 65 20 70 6c 61 |dropping| the pla|
|00002410| 79 65 72 20 75 6e 63 65 | 72 65 6d 6f 6e 69 6f 75 |yer unce|remoniou|
|00002420| 73 6c 79 20 69 6e 74 6f | 20 74 68 65 20 72 6f 6f |sly into| the roo|
|00002430| 6d 20 62 65 6c 6f 77 20 | 28 77 69 74 68 0d 0a 6e |m below |(with..n|
|00002440| 6f 20 68 61 72 6d 20 64 | 6f 6e 65 29 2e 20 20 41 |o harm d|one). A|
|00002450| 6c 6c 20 79 6f 75 20 72 | 65 61 6c 6c 79 20 77 61 |ll you r|eally wa|
|00002460| 6e 74 20 74 6f 20 64 6f | 20 68 65 72 65 20 69 73 |nt to do| here is|
|00002470| 20 74 6f 20 64 69 73 70 | 6c 61 79 0d 0a 61 20 6d | to disp|lay..a m|
|00002480| 65 73 73 61 67 65 20 61 | 62 6f 75 74 20 74 68 65 |essage a|bout the|
|00002490| 20 73 74 61 69 72 73 20 | 63 6f 6c 6c 61 70 73 69 | stairs |collapsi|
|000024a0| 6e 67 2c 20 74 68 65 6e | 20 63 6f 6d 70 6c 65 74 |ng, then| complet|
|000024b0| 65 20 74 68 65 20 74 72 | 61 76 65 6c 0d 0a 61 73 |e the tr|avel..as|
|000024c0| 20 6e 6f 72 6d 61 6c 2e | 0d 0a 0d 0a 7b 5c 65 78 | normal.|....{\ex|
|000024d0| 61 6d 70 6c 65 0d 0a 5c | 6f 62 6a 65 63 74 7b 6c |ample..\|object{l|
|000024e0| 69 76 69 6e 67 52 6f 6f | 6d 3a 20 72 6f 6f 6d 7d |ivingRoo|m: room}|
|000024f0| 0d 0a 20 20 20 20 73 64 | 65 73 63 20 3d 20 22 4c |.. sd|esc = "L|
|00002500| 69 76 69 6e 67 20 52 6f | 6f 6d 22 0d 0a 20 20 20 |iving Ro|om".. |
|00002510| 20 6c 64 65 73 63 20 3d | 20 22 59 6f 75 27 72 65 | ldesc =| "You're|
|00002520| 20 69 6e 20 74 68 65 20 | 6c 69 76 69 6e 67 20 72 | in the |living r|
|00002530| 6f 6f 6d 2e 20 20 41 20 | 64 61 72 6b 20 73 74 61 |oom. A |dark sta|
|00002540| 69 72 77 61 79 20 6c 65 | 61 64 73 0d 0a 20 20 20 |irway le|ads.. |
|00002550| 20 20 20 20 20 20 20 20 | 20 20 64 6f 77 6e 2e 22 | | down."|
|00002560| 0d 0a 20 20 20 20 64 6f | 77 6e 20 3d 0d 0a 20 20 |.. do|wn =.. |
|00002570| 20 20 5c 6c 62 0d 0a 20 | 20 20 20 20 20 20 20 22 | \lb.. | "|
|00002580| 59 6f 75 20 73 74 61 72 | 74 20 64 6f 77 6e 20 74 |You star|t down t|
|00002590| 68 65 20 73 74 61 69 72 | 73 2c 20 77 68 69 63 68 |he stair|s, which|
|000025a0| 20 63 72 65 61 6b 20 61 | 6e 64 20 6d 6f 61 6e 20 | creak a|nd moan |
|000025b0| 61 6e 64 0d 0a 20 20 20 | 20 20 20 20 20 77 6f 62 |and.. | wob|
|000025c0| 62 6c 65 20 75 6e 63 65 | 72 74 61 69 6e 6c 79 20 |ble unce|rtainly |
|000025d0| 62 65 6e 65 61 74 68 20 | 79 6f 75 2e 20 20 59 6f |beneath |you. Yo|
|000025e0| 75 20 73 74 6f 70 20 66 | 6f 72 20 61 20 6d 6f 6d |u stop f|or a mom|
|000025f0| 65 6e 74 0d 0a 20 20 20 | 20 20 20 20 20 74 6f 20 |ent.. | to |
|00002600| 73 74 65 61 64 79 20 79 | 6f 75 72 73 65 6c 66 2c |steady y|ourself,|
|00002610| 20 74 68 65 6e 20 63 6f | 6e 74 69 6e 75 65 20 64 | then co|ntinue d|
|00002620| 6f 77 6e 2c 20 77 68 65 | 6e 20 74 68 65 20 65 6e |own, whe|n the en|
|00002630| 74 69 72 65 0d 0a 20 20 | 20 20 20 20 20 20 73 74 |tire.. | st|
|00002640| 61 69 72 77 61 79 20 73 | 75 64 64 65 6e 6c 79 20 |airway s|uddenly |
|00002650| 62 72 65 61 6b 73 20 61 | 77 61 79 20 66 72 6f 6d |breaks a|way from|
|00002660| 20 74 68 65 20 77 61 6c | 6c 20 61 6e 64 20 63 72 | the wal|l and cr|
|00002670| 61 73 68 65 73 0d 0a 20 | 20 20 20 20 20 20 20 74 |ashes.. | t|
|00002680| 6f 20 74 68 65 20 66 6c | 6f 6f 72 20 62 65 6c 6f |o the fl|oor belo|
|00002690| 77 2e 20 20 59 6f 75 20 | 6c 61 6e 64 20 69 6e 20 |w. You |land in |
|000026a0| 61 20 68 65 61 70 20 6f | 66 20 73 70 6c 69 6e 74 |a heap o|f splint|
|000026b0| 65 72 65 64 0d 0a 20 20 | 20 20 20 20 20 20 77 6f |ered.. | wo|
|000026c0| 6f 64 2e 20 20 41 66 74 | 65 72 20 61 20 66 65 77 |od. Aft|er a few|
|000026d0| 20 6d 6f 6d 65 6e 74 73 | 2c 20 65 76 65 72 79 74 | moments|, everyt|
|000026e0| 68 69 6e 67 20 73 65 74 | 74 6c 65 73 2c 20 61 6e |hing set|tles, an|
|000026f0| 64 20 79 6f 75 0d 0a 20 | 20 20 20 20 20 20 20 6d |d you.. | m|
|00002700| 61 6e 61 67 65 20 74 6f | 20 67 65 74 20 75 70 20 |anage to| get up |
|00002710| 61 6e 64 20 62 72 75 73 | 68 20 79 6f 75 72 73 65 |and brus|h yourse|
|00002720| 6c 66 20 6f 66 66 2c 20 | 61 70 70 61 72 65 6e 74 |lf off, |apparent|
|00002730| 6c 79 0d 0a 20 20 20 20 | 20 20 20 20 75 6e 69 6e |ly.. | unin|
|00002740| 6a 75 72 65 64 2e 5c 63 | 68 61 72 60 5c 5c 62 22 |jured.\c|har`\\b"|
|00002750| 3b 0d 0a 20 20 20 20 20 | 20 20 20 5c 76 73 6b 69 |;.. | \vski|
|00002760| 70 31 32 70 74 0d 0a 20 | 20 20 20 20 20 20 20 72 |p12pt.. | r|
|00002770| 65 74 75 72 6e 28 63 65 | 6c 6c 61 72 29 3b 0d 0a |eturn(ce|llar);..|
|00002780| 20 20 20 20 5c 72 62 0d | 0a 5c 65 6e 64 6f 62 6a | \rb.|.\endobj|
|00002790| 0d 0a 7d 0d 0a 0d 0a 54 | 68 65 20 60 60 7b 5c 74 |..}....T|he ``{\t|
|000027a0| 74 20 5c 63 68 61 72 60 | 5c 5c 62 7d 27 27 20 69 |t \char`|\\b}'' i|
|000027b0| 73 20 61 74 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |s at the| end of |
|000027c0| 74 68 65 20 6d 65 73 73 | 61 67 65 20 74 6f 20 73 |the mess|age to s|
|000027d0| 65 70 61 72 61 74 65 20 | 74 68 65 0d 0a 6d 65 73 |eparate |the..mes|
|000027e0| 73 61 67 65 20 61 62 6f | 75 74 20 74 68 65 20 73 |sage abo|ut the s|
|000027f0| 74 61 69 72 77 61 79 27 | 73 20 63 6f 6c 6c 61 70 |tairway'|s collap|
|00002800| 73 65 20 66 72 6f 6d 20 | 74 68 65 20 64 65 73 63 |se from |the desc|
|00002810| 72 69 70 74 69 76 65 0d | 0a 74 65 78 74 20 74 68 |riptive.|.text th|
|00002820| 61 74 20 61 63 63 6f 6d | 70 61 6e 69 65 73 20 6e |at accom|panies n|
|00002830| 6f 72 6d 61 6c 20 74 72 | 61 76 65 6c 20 69 6e 74 |ormal tr|avel int|
|00002840| 6f 20 61 20 6e 65 77 20 | 72 6f 6f 6d 2e 20 20 53 |o a new |room. S|
|00002850| 69 6e 63 65 20 74 68 65 | 0d 0a 6d 65 74 68 6f 64 |ince the|..method|
|00002860| 20 6a 75 73 74 20 72 65 | 74 75 72 6e 73 20 61 20 | just re|turns a |
|00002870| 72 6f 6f 6d 20 6f 62 6a | 65 63 74 2c 20 74 72 61 |room obj|ect, tra|
|00002880| 76 65 6c 20 77 69 6c 6c | 20 70 72 6f 63 65 65 64 |vel will| proceed|
|00002890| 20 61 73 20 6e 6f 72 6d | 61 6c 0d 0a 61 66 74 65 | as norm|al..afte|
|000028a0| 72 20 74 68 65 20 6d 65 | 73 73 61 67 65 20 68 61 |r the me|ssage ha|
|000028b0| 73 20 62 65 65 6e 20 64 | 69 73 70 6c 61 79 65 64 |s been d|isplayed|
|000028c0| 2e 0d 0a 0d 0a 5c 6d 69 | 6e 6f 72 73 65 63 74 69 |.....\mi|norsecti|
|000028d0| 6f 6e 7b 53 69 6d 70 6c | 65 20 4f 62 73 74 61 63 |on{Simpl|e Obstac|
|000028e0| 6c 65 73 7d 0d 0a 0d 0a | 5e 5e 7b 6f 62 73 74 61 |les}....|^^{obsta|
|000028f0| 63 6c 65 73 7d 0d 0a 54 | 68 65 20 63 6f 6c 6c 61 |cles}..T|he colla|
|00002900| 70 73 69 6e 67 20 73 74 | 61 69 72 77 61 79 20 6f |psing st|airway o|
|00002910| 66 20 74 68 65 20 70 72 | 65 76 69 6f 75 73 20 65 |f the pr|evious e|
|00002920| 78 61 6d 70 6c 65 20 77 | 69 6c 6c 20 6e 65 65 64 |xample w|ill need|
|00002930| 20 73 6f 6d 65 0d 0a 61 | 64 64 69 74 69 6f 6e 61 | some..a|dditiona|
|00002940| 6c 20 73 70 65 63 69 61 | 6c 20 63 6f 6e 73 69 64 |l specia|l consid|
|00002950| 65 72 61 74 69 6f 6e 20 | 61 74 20 74 68 65 20 6f |eration |at the o|
|00002960| 74 68 65 72 20 65 6e 64 | 2c 20 62 65 63 61 75 73 |ther end|, becaus|
|00002970| 65 20 74 68 65 0d 0a 70 | 6c 61 79 65 72 20 63 6c |e the..p|layer cl|
|00002980| 65 61 72 6c 79 20 63 61 | 6e 27 74 20 67 6f 20 62 |early ca|n't go b|
|00002990| 61 63 6b 20 75 70 20 74 | 68 65 20 73 74 61 69 72 |ack up t|he stair|
|000029a0| 73 20 6f 6e 63 65 20 74 | 68 65 79 27 76 65 20 63 |s once t|hey've c|
|000029b0| 6f 6c 6c 61 70 73 65 64 | 2e 0d 0a 54 68 65 20 73 |ollapsed|...The s|
|000029c0| 69 6d 70 6c 65 73 74 20 | 63 61 73 65 20 69 73 20 |implest |case is |
|000029d0| 74 6f 20 64 69 73 61 6c | 6c 6f 77 20 74 72 61 76 |to disal|low trav|
|000029e0| 65 6c 20 61 6c 74 6f 67 | 65 74 68 65 72 2c 20 77 |el altog|ether, w|
|000029f0| 68 69 63 68 20 69 73 0d | 0a 73 69 6d 70 6c 65 3a |hich is.|.simple:|
|00002a00| 20 20 6a 75 73 74 20 6d | 61 6b 65 20 61 6e 20 7b | just m|ake an {|
|00002a10| 5c 74 74 20 75 70 7d 20 | 6d 65 74 68 6f 64 20 74 |\tt up} |method t|
|00002a20| 68 61 74 20 64 69 73 70 | 6c 61 79 73 20 61 6e 20 |hat disp|lays an |
|00002a30| 61 70 70 72 6f 70 72 69 | 61 74 65 0d 0a 6d 65 73 |appropri|ate..mes|
|00002a40| 73 61 67 65 2c 20 74 68 | 65 6e 20 72 65 74 75 72 |sage, th|en retur|
|00002a50| 6e 73 20 7b 5c 74 74 20 | 6e 69 6c 7d 20 74 6f 20 |ns {\tt |nil} to |
|00002a60| 69 6e 64 69 63 61 74 65 | 20 74 68 61 74 20 6e 6f |indicate| that no|
|00002a70| 20 74 72 61 76 65 6c 20 | 69 73 0d 0a 70 6f 73 73 | travel |is..poss|
|00002a80| 69 62 6c 65 20 69 6e 20 | 74 68 69 73 20 64 69 72 |ible in |this dir|
|00002a90| 65 63 74 69 6f 6e 2e 0d | 0a 0d 0a 7b 5c 65 78 61 |ection..|...{\exa|
|00002aa0| 6d 70 6c 65 0d 0a 5c 6f | 62 6a 65 63 74 7b 63 65 |mple..\o|bject{ce|
|00002ab0| 6c 6c 61 72 3a 20 72 6f | 6f 6d 7d 0d 0a 20 20 20 |llar: ro|om}.. |
|00002ac0| 20 73 64 65 73 63 20 3d | 20 22 43 65 6c 6c 61 72 | sdesc =| "Cellar|
|00002ad0| 22 0d 0a 20 20 20 20 6c | 64 65 73 63 20 3d 20 22 |".. l|desc = "|
|00002ae0| 59 6f 75 27 72 65 20 69 | 6e 20 74 68 65 20 63 65 |You're i|n the ce|
|00002af0| 6c 6c 61 72 2e 20 20 41 | 20 68 75 67 65 20 70 69 |llar. A| huge pi|
|00002b00| 6c 65 20 6f 66 20 62 72 | 6f 6b 65 6e 20 70 69 65 |le of br|oken pie|
|00002b10| 63 65 73 20 6f 66 0d 0a | 20 20 20 20 20 20 20 20 |ces of..| |
|00002b20| 20 20 20 20 77 6f 6f 64 | 20 74 68 61 74 20 77 61 | wood| that wa|
|00002b30| 73 20 6f 6e 63 65 20 61 | 20 73 74 61 69 72 77 61 |s once a| stairwa|
|00002b40| 79 20 66 69 6c 6c 73 20 | 68 61 6c 66 20 74 68 65 |y fills |half the|
|00002b50| 20 72 6f 6f 6d 2e 20 22 | 0d 0a 20 20 20 20 75 70 | room. "|.. up|
|00002b60| 20 3d 0d 0a 20 20 20 20 | 5c 6c 62 0d 0a 20 20 20 | =.. |\lb.. |
|00002b70| 20 20 20 20 20 22 54 68 | 65 20 73 74 61 69 72 77 | "Th|e stairw|
|00002b80| 61 79 20 69 73 20 69 6e | 20 6e 6f 20 63 6f 6e 64 |ay is in| no cond|
|00002b90| 69 74 69 6f 6e 20 74 6f | 20 62 65 20 63 6c 69 6d |ition to| be clim|
|00002ba0| 62 65 64 2e 20 22 3b 0d | 0a 20 20 20 20 20 20 20 |bed. ";.|. |
|00002bb0| 20 72 65 74 75 72 6e 28 | 6e 69 6c 29 3b 0d 0a 20 | return(|nil);.. |
|00002bc0| 20 20 20 5c 72 62 0d 0a | 5c 65 6e 64 6f 62 6a 0d | \rb..|\endobj.|
|00002bd0| 0a 7d 0d 0a 0d 0a 53 69 | 6e 63 65 20 74 68 65 20 |.}....Si|nce the |
|00002be0| 6d 65 74 68 6f 64 20 72 | 65 74 75 72 6e 73 20 7b |method r|eturns {|
|00002bf0| 5c 74 74 20 6e 69 6c 7d | 2c 20 6e 6f 20 66 75 72 |\tt nil}|, no fur|
|00002c00| 74 68 65 72 20 74 72 61 | 76 65 6c 20 70 72 6f 63 |ther tra|vel proc|
|00002c10| 65 73 73 69 6e 67 0d 0a | 74 61 6b 65 73 20 70 6c |essing..|takes pl|
|00002c20| 61 63 65 20 61 66 74 65 | 72 20 74 68 65 20 6d 65 |ace afte|r the me|
|00002c30| 73 73 61 67 65 20 69 73 | 20 64 69 73 70 6c 61 79 |ssage is| display|
|00002c40| 65 64 2e 0d 0a 0d 0a 4e | 6f 74 65 20 74 68 61 74 |ed.....N|ote that|
|00002c50| 20 77 65 20 73 68 6f 75 | 6c 64 20 61 64 64 20 61 | we shou|ld add a|
|00002c60| 6e 20 6f 62 6a 65 63 74 | 20 66 6f 72 20 74 68 65 |n object| for the|
|00002c70| 20 62 72 6f 6b 65 6e 20 | 73 74 61 69 72 77 61 79 | broken |stairway|
|00002c80| 2c 20 6a 75 73 74 0d 0a | 66 6f 72 20 63 6f 6d 70 |, just..|for comp|
|00002c90| 6c 65 74 65 6e 65 73 73 | 2c 20 73 6f 20 74 68 61 |leteness|, so tha|
|00002ca0| 74 20 74 68 65 20 70 6c | 61 79 65 72 20 63 61 6e |t the pl|ayer can|
|00002cb0| 20 6d 65 6e 74 69 6f 6e | 20 74 68 65 20 73 74 61 | mention| the sta|
|00002cc0| 69 72 73 20 69 6e 0d 0a | 61 20 63 6f 6d 6d 61 6e |irs in..|a comman|
|00002cd0| 64 2e 20 20 57 65 27 6c | 6c 20 6d 61 6b 65 20 69 |d. We'l|l make i|
|00002ce0| 74 20 61 20 7b 5c 74 74 | 20 66 69 78 65 64 69 74 |t a {\tt| fixedit|
|00002cf0| 65 6d 7d 20 73 69 6e 63 | 65 20 69 74 20 63 61 6e |em} sinc|e it can|
|00002d00| 27 74 20 62 65 0d 0a 6d | 6f 76 65 64 20 6f 72 20 |'t be..m|oved or |
|00002d10| 6f 74 68 65 72 77 69 73 | 65 20 6d 61 6e 69 70 75 |otherwis|e manipu|
|00002d20| 6c 61 74 65 64 2e 0d 0a | 0d 0a 7b 5c 65 78 61 6d |lated...|..{\exam|
|00002d30| 70 6c 65 0d 0a 5c 6f 62 | 6a 65 63 74 7b 62 72 6f |ple..\ob|ject{bro|
|00002d40| 6b 65 6e 53 74 61 69 72 | 73 3a 20 66 69 78 65 64 |kenStair|s: fixed|
|00002d50| 69 74 65 6d 7d 0d 0a 20 | 20 20 20 6c 6f 63 61 74 |item}.. | locat|
|00002d60| 69 6f 6e 20 3d 20 63 65 | 6c 6c 61 72 0d 0a 20 20 |ion = ce|llar.. |
|00002d70| 20 20 6e 6f 75 6e 20 3d | 20 27 73 74 61 69 72 73 | noun =| 'stairs|
|00002d80| 27 20 27 73 74 61 69 72 | 77 61 79 27 20 27 70 69 |' 'stair|way' 'pi|
|00002d90| 6c 65 27 20 27 77 6f 6f | 64 27 0d 0a 20 20 20 20 |le' 'woo|d'.. |
|00002da0| 61 64 6a 65 63 74 69 76 | 65 20 3d 20 27 62 72 6f |adjectiv|e = 'bro|
|00002db0| 6b 65 6e 27 0d 0a 20 20 | 20 20 73 64 65 73 63 20 |ken'.. | sdesc |
|00002dc0| 3d 20 22 70 69 6c 65 20 | 6f 66 20 77 6f 6f 64 22 |= "pile |of wood"|
|00002dd0| 0d 0a 20 20 20 20 6c 64 | 65 73 63 20 3d 20 22 49 |.. ld|esc = "I|
|00002de0| 74 27 73 20 61 20 68 75 | 67 65 20 70 69 6c 65 20 |t's a hu|ge pile |
|00002df0| 6f 66 20 77 6f 6f 64 20 | 74 68 61 74 20 75 73 65 |of wood |that use|
|00002e00| 64 20 74 6f 20 62 65 20 | 61 20 73 74 61 69 72 77 |d to be |a stairw|
|00002e10| 61 79 2e 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ay... | |
|00002e20| 20 59 6f 75 20 77 6f 6e | 27 74 20 68 61 76 65 20 | You won|'t have |
|00002e30| 6d 75 63 68 20 6c 75 63 | 6b 20 74 72 79 69 6e 67 |much luc|k trying|
|00002e40| 20 74 6f 20 63 6c 69 6d | 62 20 69 74 2e 20 22 0d | to clim|b it. ".|
|00002e50| 0a 5c 65 6e 64 6f 62 6a | 0d 0a 7d 0d 0a 0d 0a 5c |.\endobj|..}....\|
|00002e60| 6d 61 6a 6f 72 73 65 63 | 74 69 6f 6e 7b 41 64 61 |majorsec|tion{Ada|
|00002e70| 70 74 69 76 65 20 52 6f | 6f 6d 20 44 65 73 63 72 |ptive Ro|om Descr|
|00002e80| 69 70 74 69 6f 6e 73 7d | 0d 0a 0d 0a 54 68 65 20 |iptions}|....The |
|00002e90| 73 74 61 69 72 77 61 79 | 20 65 78 61 6d 70 6c 65 |stairway| example|
|00002ea0| 73 20 73 68 6f 77 6e 20 | 61 62 6f 76 65 20 63 6f |s shown |above co|
|00002eb0| 75 6c 64 20 62 65 20 65 | 6e 68 61 6e 63 65 64 20 |uld be e|nhanced |
|00002ec0| 74 6f 20 6d 61 6b 65 20 | 69 74 0d 0a 70 6f 73 73 |to make |it..poss|
|00002ed0| 69 62 6c 65 20 74 6f 20 | 65 6e 74 65 72 20 74 68 |ible to |enter th|
|00002ee0| 65 20 63 65 6c 6c 61 72 | 20 62 79 20 73 6f 6d 65 |e cellar| by some|
|00002ef0| 20 6f 74 68 65 72 20 70 | 61 73 73 61 67 65 2c 20 | other p|assage, |
|00002f00| 77 68 69 63 68 20 77 6f | 75 6c 64 0d 0a 6d 65 61 |which wo|uld..mea|
|00002f10| 6e 20 74 68 61 74 20 74 | 68 65 20 73 74 61 69 72 |n that t|he stair|
|00002f20| 77 61 79 20 63 6f 75 6c | 64 20 62 65 20 73 65 65 |way coul|d be see|
|00002f30| 6e 20 62 65 66 6f 72 65 | 20 69 74 20 63 6f 6c 6c |n before| it coll|
|00002f40| 61 70 73 65 73 2e 20 20 | 49 66 0d 0a 74 68 69 73 |apses. |If..this|
|00002f50| 20 77 65 72 65 20 64 6f | 6e 65 2c 20 69 74 20 77 | were do|ne, it w|
|00002f60| 6f 75 6c 64 20 62 65 20 | 6e 65 63 65 73 73 61 72 |ould be |necessar|
|00002f70| 79 20 66 6f 72 20 74 68 | 65 20 63 65 6c 6c 61 72 |y for th|e cellar|
|00002f80| 27 73 20 72 6f 6f 6d 0d | 0a 64 65 73 63 72 69 70 |'s room.|.descrip|
|00002f90| 74 69 6f 6e 2c 20 61 73 | 20 77 65 6c 6c 20 61 73 |tion, as| well as|
|00002fa0| 20 74 68 65 20 7b 5c 74 | 74 20 75 70 7d 20 6d 65 | the {\t|t up} me|
|00002fb0| 74 68 6f 64 2c 20 74 6f | 20 62 65 20 73 65 6e 73 |thod, to| be sens|
|00002fc0| 69 74 69 76 65 20 74 6f | 0d 0a 77 68 65 74 68 65 |itive to|..whethe|
|00002fd0| 72 20 74 68 65 20 73 74 | 61 69 72 77 61 79 20 68 |r the st|airway h|
|00002fe0| 61 64 20 63 6f 6c 6c 61 | 70 73 65 64 20 79 65 74 |ad colla|psed yet|
|00002ff0| 2e 0d 0a 0d 0a 4d 61 6b | 69 6e 67 20 61 20 72 6f |.....Mak|ing a ro|
|00003000| 6f 6d 20 64 65 73 63 72 | 69 70 74 69 6f 6e 20 74 |om descr|iption t|
|00003010| 68 61 74 20 61 64 61 70 | 74 73 20 74 6f 20 74 68 |hat adap|ts to th|
|00003020| 65 20 73 74 61 74 65 20 | 6f 66 20 74 68 65 20 72 |e state |of the r|
|00003030| 6f 6f 6d 0d 0a 69 73 20 | 64 6f 6e 65 20 62 79 20 |oom..is |done by |
|00003040| 74 75 72 6e 69 6e 67 20 | 7b 5c 74 74 20 6c 64 65 |turning |{\tt lde|
|00003050| 73 63 7d 20 69 6e 74 6f | 20 61 20 6d 65 74 68 6f |sc} into| a metho|
|00003060| 64 2e 20 20 4a 75 73 74 | 20 61 73 20 73 70 65 63 |d. Just| as spec|
|00003070| 69 61 6c 0d 0a 74 72 61 | 76 65 6c 20 65 66 66 65 |ial..tra|vel effe|
|00003080| 63 74 73 20 63 61 6e 20 | 62 65 20 61 63 68 69 65 |cts can |be achie|
|00003090| 76 65 64 20 62 79 20 6d | 61 6b 69 6e 67 20 61 20 |ved by m|aking a |
|000030a0| 64 69 72 65 63 74 69 6f | 6e 20 70 72 6f 70 65 72 |directio|n proper|
|000030b0| 74 79 0d 0a 69 6e 74 6f | 20 61 20 6d 65 74 68 6f |ty..into| a metho|
|000030c0| 64 2c 20 73 70 65 63 69 | 61 6c 20 72 6f 6f 6d 20 |d, speci|al room |
|000030d0| 64 65 73 63 72 69 70 74 | 69 6f 6e 73 20 63 61 6e |descript|ions can|
|000030e0| 20 62 65 20 70 72 6f 67 | 72 61 6d 6d 65 64 20 62 | be prog|rammed b|
|000030f0| 79 0d 0a 6d 61 6b 69 6e | 67 20 7b 5c 74 74 20 6c |y..makin|g {\tt l|
|00003100| 64 65 73 63 7d 20 61 20 | 6d 65 74 68 6f 64 2e 0d |desc} a |method..|
|00003110| 0a 0d 0a 53 69 6e 63 65 | 20 74 68 65 20 73 74 61 |...Since| the sta|
|00003120| 69 72 77 61 79 20 63 61 | 6e 20 62 65 20 73 65 65 |irway ca|n be see|
|00003130| 6e 20 62 65 66 6f 72 65 | 20 69 74 27 73 20 63 6f |n before| it's co|
|00003140| 6c 6c 61 70 73 65 64 2c | 20 77 65 27 6c 6c 0d 0a |llapsed,| we'll..|
|00003150| 69 6e 74 72 6f 64 75 63 | 65 20 61 20 6e 65 77 20 |introduc|e a new |
|00003160| 6f 62 6a 65 63 74 20 66 | 6f 72 20 74 68 65 20 77 |object f|or the w|
|00003170| 6f 72 6b 69 6e 67 20 73 | 74 61 69 72 73 2e 20 20 |orking s|tairs. |
|00003180| 4e 6f 74 65 20 74 68 61 | 74 0d 0a 74 68 69 73 20 |Note tha|t..this |
|00003190| 6f 62 6a 65 63 74 20 73 | 68 6f 75 6c 64 20 62 65 |object s|hould be|
|000031a0| 20 63 6c 69 6d 62 61 62 | 6c 65 2c 20 73 6f 20 77 | climbab|le, so w|
|000031b0| 65 27 6c 6c 20 64 65 66 | 69 6e 65 20 7b 5c 74 74 |e'll def|ine {\tt|
|000031c0| 20 76 65 72 44 6f 43 6c | 69 6d 62 7d 0d 0a 61 6e | verDoCl|imb}..an|
|000031d0| 64 20 7b 5c 74 74 20 64 | 6f 43 6c 69 6d 62 7d 20 |d {\tt d|oClimb} |
|000031e0| 6d 65 74 68 6f 64 73 20 | 66 6f 72 20 69 74 2e 20 |methods |for it. |
|000031f0| 20 4e 6f 74 65 20 74 68 | 61 74 20 74 68 65 20 6d | Note th|at the m|
|00003200| 65 74 68 6f 64 0d 0a 7b | 5c 74 74 20 61 63 74 6f |ethod..{|\tt acto|
|00003210| 72 2e 74 72 61 76 65 6c | 54 6f 28 7b 5c 69 74 20 |r.travel|To({\it |
|00003220| 6c 6f 63 61 74 69 6f 6e | 7d 29 7d 20 69 73 20 74 |location|})} is t|
|00003230| 68 65 20 65 78 61 63 74 | 20 73 61 6d 65 0d 0a 6d |he exact| same..m|
|00003240| 65 74 68 6f 64 20 74 68 | 61 74 20 69 73 20 63 61 |ethod th|at is ca|
|00003250| 6c 6c 65 64 20 77 68 65 | 6e 20 74 68 65 20 70 6c |lled whe|n the pl|
|00003260| 61 79 65 72 20 74 72 61 | 76 65 6c 73 20 6e 6f 72 |ayer tra|vels nor|
|00003270| 6d 61 6c 6c 79 20 62 79 | 0d 0a 74 79 70 69 6e 67 |mally by|..typing|
|00003280| 20 61 20 64 69 72 65 63 | 74 69 6f 6e 20 63 6f 6d | a direc|tion com|
|00003290| 6d 61 6e 64 20 28 73 75 | 63 68 20 61 73 20 60 60 |mand (su|ch as ``|
|000032a0| 75 70 27 27 29 2e 20 20 | 20 41 6c 73 6f 20 6e 6f |up''). | Also no|
|000032b0| 74 65 20 74 68 61 74 20 | 74 68 65 0d 0a 7b 5c 74 |te that |the..{\t|
|000032c0| 74 20 6c 6f 63 61 74 69 | 6f 6e 7d 20 70 72 6f 70 |t locati|on} prop|
|000032d0| 65 72 74 79 20 6f 66 20 | 74 68 65 20 7b 5c 74 74 |erty of |the {\tt|
|000032e0| 20 62 72 6f 6b 65 6e 53 | 74 61 69 72 73 7d 20 6f | brokenS|tairs} o|
|000032f0| 62 6a 65 63 74 20 73 68 | 6f 75 6c 64 0d 0a 69 6e |bject sh|ould..in|
|00003300| 69 74 69 61 6c 6c 79 20 | 6e 6f 74 20 62 65 20 73 |itially |not be s|
|00003310| 65 74 20 28 77 68 69 63 | 68 20 77 69 6c 6c 20 6d |et (whic|h will m|
|00003320| 61 6b 65 20 69 74 20 7b | 5c 74 74 20 6e 69 6c 7d |ake it {|\tt nil}|
|00003330| 29 2c 20 73 69 6e 63 65 | 20 74 68 65 0d 0a 62 72 |), since| the..br|
|00003340| 6f 6b 65 6e 20 73 74 61 | 69 72 77 61 79 20 69 73 |oken sta|irway is|
|00003350| 20 6e 6f 74 20 70 61 72 | 74 20 6f 66 20 74 68 65 | not par|t of the|
|00003360| 20 67 61 6d 65 20 69 6e | 69 74 69 61 6c 6c 79 20 | game in|itially |
|00003370| 69 6e 20 74 68 65 20 6e | 65 77 0d 0a 63 6f 6e 66 |in the n|ew..conf|
|00003380| 69 67 75 72 61 74 69 6f | 6e 2e 20 20 0d 0a 0d 0a |iguratio|n. ....|
|00003390| 7b 5c 65 78 61 6d 70 6c | 65 0d 0a 5c 6f 62 6a 65 |{\exampl|e..\obje|
|000033a0| 63 74 7b 77 6f 72 6b 69 | 6e 67 53 74 61 69 72 73 |ct{worki|ngStairs|
|000033b0| 3a 20 66 69 78 65 64 69 | 74 65 6d 7d 0d 0a 20 20 |: fixedi|tem}.. |
|000033c0| 20 20 6c 6f 63 61 74 69 | 6f 6e 20 3d 20 63 65 6c | locati|on = cel|
|000033d0| 6c 61 72 0d 0a 20 20 20 | 20 6e 6f 75 6e 20 3d 20 |lar.. | noun = |
|000033e0| 27 73 74 61 69 72 73 27 | 20 27 73 74 61 69 72 77 |'stairs'| 'stairw|
|000033f0| 61 79 27 0d 0a 20 20 20 | 20 73 64 65 73 63 20 3d |ay'.. | sdesc =|
|00003400| 20 22 73 74 61 69 72 73 | 22 0d 0a 20 20 20 20 6c | "stairs|".. l|
|00003410| 64 65 73 63 20 3d 20 22 | 54 68 65 20 73 74 61 69 |desc = "|The stai|
|00003420| 72 77 61 79 20 6c 65 61 | 64 73 20 75 70 2e 20 20 |rway lea|ds up. |
|00003430| 49 74 20 6c 6f 6f 6b 73 | 20 65 78 74 72 65 6d 65 |It looks| extreme|
|00003440| 6c 79 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ly.. | |
|00003450| 72 69 63 6b 65 74 79 2e | 20 22 0d 0a 20 20 20 20 |rickety.| ".. |
|00003460| 76 65 72 44 6f 43 6c 69 | 6d 62 28 61 63 74 6f 72 |verDoCli|mb(actor|
|00003470| 29 20 3d 20 5c 63 68 61 | 72 60 5c 7b 5c 63 68 61 |) = \cha|r`\{\cha|
|00003480| 72 60 5c 7d 0d 0a 20 20 | 20 20 64 6f 43 6c 69 6d |r`\}.. | doClim|
|00003490| 62 28 61 63 74 6f 72 29 | 20 3d 0d 0a 20 20 20 20 |b(actor)| =.. |
|000034a0| 5c 6c 62 0d 0a 09 61 63 | 74 6f 72 2e 74 72 61 76 |\lb...ac|tor.trav|
|000034b0| 65 6c 54 6f 28 6c 69 76 | 69 6e 67 52 6f 6f 6d 29 |elTo(liv|ingRoom)|
|000034c0| 3b 0d 0a 20 20 20 20 5c | 72 62 0d 0a 5c 65 6e 64 |;.. \|rb..\end|
|000034d0| 6f 62 6a 0d 0a 7d 0d 0a | 0d 0a 4e 6f 77 20 77 65 |obj..}..|..Now we|
|000034e0| 27 6c 6c 20 63 68 61 6e | 67 65 20 74 68 65 20 7b |'ll chan|ge the {|
|000034f0| 5c 74 74 20 63 65 6c 6c | 61 72 7d 20 6f 62 6a 65 |\tt cell|ar} obje|
|00003500| 63 74 27 73 20 7b 5c 74 | 74 20 75 70 7d 20 6d 65 |ct's {\t|t up} me|
|00003510| 74 68 6f 64 2c 20 61 73 | 0d 0a 77 65 6c 6c 20 61 |thod, as|..well a|
|00003520| 73 20 69 74 73 20 7b 5c | 74 74 20 6c 64 65 73 63 |s its {\|tt ldesc|
|00003530| 7d 20 70 72 6f 70 65 72 | 74 79 2c 20 74 6f 20 72 |} proper|ty, to r|
|00003540| 65 66 6c 65 63 74 20 74 | 68 65 20 63 75 72 72 65 |eflect t|he curre|
|00003550| 6e 74 20 73 74 61 74 75 | 73 0d 0a 6f 66 20 74 68 |nt statu|s..of th|
|00003560| 65 20 73 74 61 69 72 73 | 2e 20 20 57 65 27 6c 6c |e stairs|. We'll|
|00003570| 20 64 65 74 65 63 74 20 | 77 68 65 74 68 65 72 20 | detect |whether |
|00003580| 74 68 65 20 73 74 61 69 | 72 73 20 68 61 76 65 20 |the stai|rs have |
|00003590| 63 6f 6c 6c 61 70 73 65 | 64 0d 0a 79 65 74 20 62 |collapse|d..yet b|
|000035a0| 79 20 63 68 65 63 6b 69 | 6e 67 20 74 68 65 20 6c |y checki|ng the l|
|000035b0| 6f 63 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 7b |ocation |of the {|
|000035c0| 5c 74 74 20 77 6f 72 6b | 69 6e 67 53 74 61 69 72 |\tt work|ingStair|
|000035d0| 73 7d 20 6f 62 6a 65 63 | 74 3a 0d 0a 69 66 20 69 |s} objec|t:..if i|
|000035e0| 74 27 73 20 69 6e 20 74 | 68 65 20 63 65 6c 6c 61 |t's in t|he cella|
|000035f0| 72 2c 20 77 65 27 6c 6c | 20 6b 6e 6f 77 20 74 68 |r, we'll| know th|
|00003600| 65 20 73 74 61 69 72 73 | 20 68 61 76 65 6e 27 74 |e stairs| haven't|
|00003610| 20 63 6f 6c 6c 61 70 73 | 65 64 0d 0a 79 65 74 2c | collaps|ed..yet,|
|00003620| 20 61 6e 64 20 69 66 20 | 69 74 27 73 20 6e 6f 74 | and if |it's not|
|00003630| 20 61 6e 79 77 68 65 72 | 65 20 28 74 68 61 74 20 | anywher|e (that |
|00003640| 69 73 2c 20 69 66 20 69 | 74 27 73 20 6c 6f 63 61 |is, if i|t's loca|
|00003650| 74 69 6f 6e 20 69 73 0d | 0a 7b 5c 74 74 20 6e 69 |tion is.|.{\tt ni|
|00003660| 6c 7d 29 2c 20 77 65 27 | 6c 6c 20 6b 6e 6f 77 20 |l}), we'|ll know |
|00003670| 74 68 61 74 20 74 68 65 | 20 73 74 61 69 72 73 20 |that the| stairs |
|00003680| 68 61 76 65 20 63 6f 6c | 6c 61 70 73 65 64 2e 20 |have col|lapsed. |
|00003690| 20 28 54 68 69 73 0d 0a | 6f 62 6a 65 63 74 20 73 | (This..|object s|
|000036a0| 77 69 74 63 68 20 77 69 | 6c 6c 20 62 65 20 69 6d |witch wi|ll be im|
|000036b0| 70 6c 65 6d 65 6e 74 65 | 64 20 62 65 6c 6f 77 2c |plemente|d below,|
|000036c0| 20 69 6e 20 74 68 65 20 | 7b 5c 74 74 20 6c 69 76 | in the |{\tt liv|
|000036d0| 69 6e 67 52 6f 6f 6d 7d | 0d 0a 6f 62 6a 65 63 74 |ingRoom}|..object|
|000036e0| 27 73 20 7b 5c 74 74 20 | 64 6f 77 6e 7d 20 6d 65 |'s {\tt |down} me|
|000036f0| 74 68 6f 64 2e 29 20 20 | 57 65 27 6c 6c 20 75 73 |thod.) |We'll us|
|00003700| 65 20 74 68 69 73 20 64 | 65 74 65 63 74 69 6f 6e |e this d|etection|
|00003710| 20 74 65 63 68 6e 69 71 | 75 65 0d 0a 74 6f 20 6d | techniq|ue..to m|
|00003720| 61 6b 65 20 62 6f 74 68 | 20 74 68 65 20 7b 5c 74 |ake both| the {\t|
|00003730| 74 20 6c 64 65 73 63 7d | 20 61 6e 64 20 74 68 65 |t ldesc}| and the|
|00003740| 20 7b 5c 74 74 20 75 70 | 7d 20 6d 65 74 68 6f 64 | {\tt up|} method|
|00003750| 20 73 65 6e 73 69 74 69 | 76 65 0d 0a 74 6f 20 74 | sensiti|ve..to t|
|00003760| 68 65 20 73 74 61 74 75 | 73 20 6f 66 20 74 68 65 |he statu|s of the|
|00003770| 20 73 74 61 69 72 77 61 | 79 2e 0d 0a 0d 0a 7b 5c | stairwa|y.....{\|
|00003780| 65 78 61 6d 70 6c 65 0d | 0a 5c 6f 62 6a 65 63 74 |example.|.\object|
|00003790| 7b 63 65 6c 6c 61 72 3a | 20 72 6f 6f 6d 7d 0d 0a |{cellar:| room}..|
|000037a0| 20 20 20 20 73 64 65 73 | 63 20 3d 20 22 43 65 6c | sdes|c = "Cel|
|000037b0| 6c 61 72 22 0d 0a 20 20 | 20 20 6c 64 65 73 63 20 |lar".. | ldesc |
|000037c0| 3d 0d 0a 20 20 20 20 5c | 6c 62 0d 0a 20 20 20 20 |=.. \|lb.. |
|000037d0| 20 20 20 20 22 59 6f 75 | 27 72 65 20 69 6e 20 74 | "You|'re in t|
|000037e0| 68 65 20 63 65 6c 6c 61 | 72 2e 20 22 3b 0d 0a 20 |he cella|r. ";.. |
|000037f0| 20 20 20 20 20 20 20 69 | 66 20 28 77 6f 72 6b 69 | i|f (worki|
|00003800| 6e 67 53 74 61 69 72 73 | 2e 6c 6f 63 61 74 69 6f |ngStairs|.locatio|
|00003810| 6e 20 3d 20 6e 69 6c 29 | 0d 0a 20 20 20 20 20 20 |n = nil)|.. |
|00003820| 20 20 5c 69 6e 76 69 73 | 6c 62 0d 0a 20 20 20 20 | \invis|lb.. |
|00003830| 20 20 20 20 20 20 20 20 | 22 41 20 68 75 67 65 20 | |"A huge |
|00003840| 70 69 6c 65 20 6f 66 20 | 62 72 6f 6b 65 6e 20 70 |pile of |broken p|
|00003850| 69 65 63 65 73 20 6f 66 | 20 77 6f 6f 64 20 74 68 |ieces of| wood th|
|00003860| 61 74 20 77 61 73 0d 0a | 20 20 20 20 20 20 20 20 |at was..| |
|00003870| 20 20 20 20 6f 6e 63 65 | 20 61 20 73 74 61 69 72 | once| a stair|
|00003880| 77 61 79 20 66 69 6c 6c | 73 20 68 61 6c 66 20 74 |way fill|s half t|
|00003890| 68 65 20 72 6f 6f 6d 2e | 20 22 3b 0d 0a 20 20 20 |he room.| ";.. |
|000038a0| 20 20 20 20 20 5c 69 6e | 76 69 73 72 62 0d 0a 20 | \in|visrb.. |
|000038b0| 20 20 20 20 20 20 20 65 | 6c 73 65 0d 0a 20 20 20 | e|lse.. |
|000038c0| 20 20 20 20 20 5c 69 6e | 76 69 73 6c 62 0d 0a 20 | \in|vislb.. |
|000038d0| 20 20 20 20 20 20 20 20 | 20 20 20 22 41 20 73 75 | | "A su|
|000038e0| 73 70 69 63 69 6f 75 73 | 2d 6c 6f 6f 6b 69 6e 67 |spicious|-looking|
|000038f0| 20 73 74 61 69 72 77 61 | 79 20 6c 65 61 64 73 20 | stairwa|y leads |
|00003900| 75 70 2e 20 22 3b 0d 0a | 20 20 20 20 20 20 20 20 |up. ";..| |
|00003910| 5c 69 6e 76 69 73 72 62 | 0d 0a 20 20 20 20 5c 72 |\invisrb|.. \r|
|00003920| 62 0d 0a 20 20 20 20 75 | 70 20 3d 0d 0a 20 20 20 |b.. u|p =.. |
|00003930| 20 5c 6c 62 0d 0a 20 20 | 20 20 20 20 20 20 69 66 | \lb.. | if|
|00003940| 20 28 77 6f 72 6b 69 6e | 67 53 74 61 69 72 73 2e | (workin|gStairs.|
|00003950| 6c 6f 63 61 74 69 6f 6e | 20 3d 20 6e 69 6c 29 0d |location| = nil).|
|00003960| 0a 20 20 20 20 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |. | \lb.. |
|00003970| 20 20 20 20 20 20 20 20 | 20 20 22 54 68 65 20 73 | | "The s|
|00003980| 74 61 69 72 77 61 79 20 | 69 73 20 69 6e 20 6e 6f |tairway |is in no|
|00003990| 20 63 6f 6e 64 69 74 69 | 6f 6e 20 74 6f 20 62 65 | conditi|on to be|
|000039a0| 20 63 6c 69 6d 62 65 64 | 2e 20 22 3b 0d 0a 20 20 | climbed|. ";.. |
|000039b0| 20 20 20 20 20 20 20 20 | 20 20 72 65 74 75 72 6e | | return|
|000039c0| 28 6e 69 6c 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |(nil);..| |
|000039d0| 5c 72 62 0d 0a 20 20 20 | 20 20 20 20 20 65 6c 73 |\rb.. | els|
|000039e0| 65 0d 0a 20 20 20 20 20 | 20 20 20 5c 6c 62 0d 0a |e.. | \lb..|
|000039f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 22 54 68 65 | | "The|
|00003a00| 20 73 74 61 69 72 73 20 | 63 72 65 61 6b 20 61 6e | stairs |creak an|
|00003a10| 64 20 6d 6f 61 6e 20 61 | 6e 64 20 73 77 61 79 2c |d moan a|nd sway,|
|00003a20| 20 62 75 74 20 79 6f 75 | 0d 0a 20 20 20 20 20 20 | but you|.. |
|00003a30| 20 20 20 20 20 20 73 6f | 6d 65 68 6f 77 20 6d 61 | so|mehow ma|
|00003a40| 6e 61 67 65 20 74 6f 20 | 63 6c 69 6d 62 20 74 68 |nage to |climb th|
|00003a50| 65 6d 20 73 61 66 65 6c | 79 2e 5c 63 68 61 72 60 |em safel|y.\char`|
|00003a60| 5c 5c 62 22 3b 0d 0a 20 | 20 20 20 20 20 20 20 20 |\\b";.. | |
|00003a70| 20 20 20 72 65 74 75 72 | 6e 28 6c 69 76 69 6e 67 | retur|n(living|
|00003a80| 52 6f 6f 6d 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |Room);..| |
|00003a90| 5c 72 62 0d 0a 20 20 20 | 20 5c 72 62 0d 0a 5c 65 |\rb.. | \rb..\e|
|00003aa0| 6e 64 6f 62 6a 0d 0a 7d | 0d 0a 0d 0a 57 65 27 6c |ndobj..}|....We'l|
|00003ab0| 6c 20 61 6c 73 6f 20 68 | 61 76 65 20 74 6f 20 6d |l also h|ave to m|
|00003ac0| 61 6b 65 20 61 20 73 6d | 61 6c 6c 20 63 68 61 6e |ake a sm|all chan|
|00003ad0| 67 65 20 74 6f 20 74 68 | 65 20 7b 5c 74 74 20 64 |ge to th|e {\tt d|
|00003ae0| 6f 77 6e 7d 20 6d 65 74 | 68 6f 64 0d 0a 69 6e 20 |own} met|hod..in |
|00003af0| 74 68 65 20 7b 5c 74 74 | 20 6c 69 76 69 6e 67 52 |the {\tt| livingR|
|00003b00| 6f 6f 6d 7d 20 6f 62 6a | 65 63 74 2c 20 74 6f 20 |oom} obj|ect, to |
|00003b10| 72 65 70 6c 61 63 65 20 | 74 68 65 20 7b 5c 74 74 |replace |the {\tt|
|00003b20| 20 77 6f 72 6b 69 6e 67 | 53 74 61 69 72 73 7d 0d | working|Stairs}.|
|00003b30| 0a 6f 62 6a 65 63 74 20 | 77 69 74 68 20 74 68 65 |.object |with the|
|00003b40| 20 7b 5c 74 74 20 62 72 | 6f 6b 65 6e 53 74 61 69 | {\tt br|okenStai|
|00003b50| 72 73 7d 20 6f 62 6a 65 | 63 74 2e 20 20 48 65 72 |rs} obje|ct. Her|
|00003b60| 65 27 73 20 74 68 65 20 | 6e 65 77 0d 0a 7b 5c 74 |e's the |new..{\t|
|00003b70| 74 20 64 6f 77 6e 7d 20 | 6d 65 74 68 6f 64 2c 20 |t down} |method, |
|00003b80| 77 68 69 63 68 20 77 69 | 6c 6c 0d 0a 72 65 6d 6f |which wi|ll..remo|
|00003b90| 76 65 20 74 68 65 20 7b | 5c 74 74 20 77 6f 72 6b |ve the {|\tt work|
|00003ba0| 69 6e 67 53 74 61 69 72 | 73 7d 20 6f 62 6a 65 63 |ingStair|s} objec|
|00003bb0| 74 20 66 72 6f 6d 20 74 | 68 65 20 67 61 6d 65 20 |t from t|he game |
|00003bc0| 62 79 20 6d 6f 76 69 6e | 67 20 69 74 0d 0a 74 6f |by movin|g it..to|
|00003bd0| 20 7b 5c 74 74 20 6e 69 | 6c 7d 2c 20 61 6e 64 20 | {\tt ni|l}, and |
|00003be0| 70 75 74 20 74 68 65 20 | 7b 5c 74 74 20 62 72 6f |put the |{\tt bro|
|00003bf0| 6b 65 6e 53 74 61 69 72 | 73 7d 20 6f 62 6a 65 63 |kenStair|s} objec|
|00003c00| 74 20 69 6e 20 69 74 73 | 20 70 6c 61 63 65 2e 0d |t in its| place..|
|00003c10| 0a 0d 0a 7b 5c 65 78 61 | 6d 70 6c 65 0d 0a 5c 6f |...{\exa|mple..\o|
|00003c20| 62 6a 65 63 74 7b 6c 69 | 76 69 6e 67 52 6f 6f 6d |bject{li|vingRoom|
|00003c30| 3a 20 72 6f 6f 6d 7d 0d | 0a 20 20 20 20 73 64 65 |: room}.|. sde|
|00003c40| 73 63 20 3d 20 22 4c 69 | 76 69 6e 67 20 52 6f 6f |sc = "Li|ving Roo|
|00003c50| 6d 22 0d 0a 20 20 20 20 | 6c 64 65 73 63 20 3d 20 |m".. |ldesc = |
|00003c60| 22 59 6f 75 27 72 65 20 | 69 6e 20 74 68 65 20 6c |"You're |in the l|
|00003c70| 69 76 69 6e 67 20 72 6f | 6f 6d 2e 20 20 41 20 64 |iving ro|om. A d|
|00003c80| 61 72 6b 20 73 74 61 69 | 72 77 61 79 20 6c 65 61 |ark stai|rway lea|
|00003c90| 64 73 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ds.. | |
|00003ca0| 20 64 6f 77 6e 2e 22 0d | 0a 20 20 20 20 64 6f 77 | down.".|. dow|
|00003cb0| 6e 20 3d 0d 0a 20 20 20 | 20 5c 6c 62 0d 0a 20 20 |n =.. | \lb.. |
|00003cc0| 20 20 20 20 20 20 69 66 | 20 28 77 6f 72 6b 69 6e | if| (workin|
|00003cd0| 67 53 74 61 69 72 73 2e | 6c 6f 63 61 74 69 6f 6e |gStairs.|location|
|00003ce0| 20 3d 20 6e 69 6c 29 0d | 0a 20 20 20 20 20 20 20 | = nil).|. |
|00003cf0| 20 5c 6c 62 0d 0a 20 20 | 20 20 20 20 20 20 20 20 | \lb.. | |
|00003d00| 20 20 22 59 6f 75 20 71 | 75 69 63 6b 6c 79 20 6e | "You q|uickly n|
|00003d10| 6f 74 69 63 65 20 74 68 | 61 74 20 74 68 65 20 73 |otice th|at the s|
|00003d20| 74 61 69 72 73 20 68 61 | 76 65 0d 0a 20 20 20 20 |tairs ha|ve.. |
|00003d30| 20 20 20 20 20 20 20 20 | 63 6f 6c 6c 61 70 73 65 | |collapse|
|00003d40| 64 2c 20 73 6f 20 74 68 | 65 72 65 27 73 20 6e 6f |d, so th|ere's no|
|00003d50| 20 77 61 79 20 64 6f 77 | 6e 2e 20 22 3b 0d 0a 20 | way dow|n. ";.. |
|00003d60| 20 20 20 20 20 20 20 20 | 20 20 20 72 65 74 75 72 | | retur|
|00003d70| 6e 28 6e 69 6c 29 3b 0d | 0a 20 20 20 20 20 20 20 |n(nil);.|. |
|00003d80| 20 5c 72 62 0d 0a 20 20 | 20 20 20 20 20 20 65 6c | \rb.. | el|
|00003d90| 73 65 0d 0a 20 20 20 20 | 20 20 20 20 5c 6c 62 0d |se.. | \lb.|
|00003da0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 22 59 6f |. | "Yo|
|00003db0| 75 20 73 74 61 72 74 20 | 64 6f 77 6e 20 74 68 65 |u start |down the|
|00003dc0| 20 73 74 61 69 72 73 2c | 20 77 68 69 63 68 20 63 | stairs,| which c|
|00003dd0| 72 65 61 6b 20 61 6e 64 | 20 6d 6f 61 6e 20 61 6e |reak and| moan an|
|00003de0| 64 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 77 |d.. | w|
|00003df0| 6f 62 62 6c 65 20 75 6e | 63 65 72 74 61 69 6e 6c |obble un|certainl|
|00003e00| 79 20 62 65 6e 65 61 74 | 68 20 79 6f 75 2e 20 20 |y beneat|h you. |
|00003e10| 59 6f 75 20 73 74 6f 70 | 20 66 6f 72 20 61 20 6d |You stop| for a m|
|00003e20| 6f 6d 65 6e 74 0d 0a 20 | 20 20 20 20 20 20 20 20 |oment.. | |
|00003e30| 20 20 20 74 6f 20 73 74 | 65 61 64 79 20 79 6f 75 | to st|eady you|
|00003e40| 72 73 65 6c 66 2c 20 74 | 68 65 6e 20 63 6f 6e 74 |rself, t|hen cont|
|00003e50| 69 6e 75 65 20 64 6f 77 | 6e 2c 20 77 68 65 6e 20 |inue dow|n, when |
|00003e60| 74 68 65 20 65 6e 74 69 | 72 65 0d 0a 20 20 20 20 |the enti|re.. |
|00003e70| 20 20 20 20 20 20 20 20 | 73 74 61 69 72 77 61 79 | |stairway|
|00003e80| 20 73 75 64 64 65 6e 6c | 79 20 62 72 65 61 6b 73 | suddenl|y breaks|
|00003e90| 20 61 77 61 79 20 66 72 | 6f 6d 20 74 68 65 20 77 | away fr|om the w|
|00003ea0| 61 6c 6c 20 61 6e 64 20 | 63 72 61 73 68 65 73 0d |all and |crashes.|
|00003eb0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 74 6f 20 |. | to |
|00003ec0| 74 68 65 20 66 6c 6f 6f | 72 20 62 65 6c 6f 77 2e |the floo|r below.|
|00003ed0| 20 20 59 6f 75 20 6c 61 | 6e 64 20 69 6e 20 61 20 | You la|nd in a |
|00003ee0| 68 65 61 70 20 6f 66 20 | 73 70 6c 69 6e 74 65 72 |heap of |splinter|
|00003ef0| 65 64 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |ed.. | |
|00003f00| 77 6f 6f 64 2e 20 20 41 | 66 74 65 72 20 61 20 66 |wood. A|fter a f|
|00003f10| 65 77 20 6d 6f 6d 65 6e | 74 73 2c 20 65 76 65 72 |ew momen|ts, ever|
|00003f20| 79 74 68 69 6e 67 20 73 | 65 74 74 6c 65 73 2c 20 |ything s|ettles, |
|00003f30| 61 6e 64 20 79 6f 75 0d | 0a 20 20 20 20 20 20 20 |and you.|. |
|00003f40| 20 20 20 20 20 6d 61 6e | 61 67 65 20 74 6f 20 67 | man|age to g|
|00003f50| 65 74 20 75 70 20 61 6e | 64 20 62 72 75 73 68 20 |et up an|d brush |
|00003f60| 79 6f 75 72 73 65 6c 66 | 20 6f 66 66 2c 20 61 70 |yourself| off, ap|
|00003f70| 70 61 72 65 6e 74 6c 79 | 0d 0a 20 20 20 20 20 20 |parently|.. |
|00003f80| 20 20 20 20 20 20 75 6e | 69 6e 6a 75 72 65 64 2e | un|injured.|
|00003f90| 5c 63 68 61 72 60 5c 5c | 62 22 3b 0d 0a 20 20 20 |\char`\\|b";.. |
|00003fa0| 20 20 20 20 20 20 20 20 | 20 5c 76 73 6b 69 70 31 | | \vskip1|
|00003fb0| 32 70 74 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |2pt.. | |
|00003fc0| 20 77 6f 72 6b 69 6e 67 | 53 74 61 69 72 73 2e 6d | working|Stairs.m|
|00003fd0| 6f 76 65 49 6e 74 6f 28 | 6e 69 6c 29 3b 20 5c 68 |oveInto(|nil); \h|
|00003fe0| 66 69 6c 6c 20 2f 2a 20 | 72 65 70 6c 61 63 65 20 |fill /* |replace |
|00003ff0| 77 6f 72 6b 69 6e 67 53 | 74 61 69 72 73 2e 2e 2e |workingS|tairs...|
|00004000| 20 2a 2f 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 | */.. | |
|00004010| 20 62 72 6f 6b 65 6e 53 | 74 61 69 72 73 2e 6d 6f | brokenS|tairs.mo|
|00004020| 76 65 49 6e 74 6f 28 63 | 65 6c 6c 61 72 29 3b 20 |veInto(c|ellar); |
|00004030| 20 5c 68 66 69 6c 6c 20 | 2f 2a 20 2e 2e 2e 20 77 | \hfill |/* ... w|
|00004040| 69 74 68 20 62 72 6f 6b | 65 6e 53 74 61 69 72 73 |ith brok|enStairs|
|00004050| 20 2a 2f 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 | */.. | |
|00004060| 20 72 65 74 75 72 6e 28 | 63 65 6c 6c 61 72 29 3b | return(|cellar);|
|00004070| 0d 0a 20 20 20 20 20 20 | 20 20 5c 72 62 0d 0a 20 |.. | \rb.. |
|00004080| 20 20 20 5c 72 62 0d 0a | 5c 65 6e 64 6f 62 6a 0d | \rb..|\endobj.|
|00004090| 0a 7d 0d 0a 0d 0a 5c 6d | 61 6a 6f 72 73 65 63 74 |.}....\m|ajorsect|
|000040a0| 69 6f 6e 7b 44 6f 6f 72 | 73 7d 0d 0a 0d 0a 5e 5e |ion{Door|s}....^^|
|000040b0| 7b 64 6f 6f 72 73 7d 0d | 0a 4f 6e 65 20 63 6f 6d |{doors}.|.One com|
|000040c0| 6d 6f 6e 20 74 79 70 65 | 20 6f 66 20 6f 62 73 74 |mon type| of obst|
|000040d0| 61 63 6c 65 20 69 73 20 | 61 20 64 6f 6f 72 2e 20 |acle is |a door. |
|000040e0| 20 44 6f 6f 72 73 20 63 | 61 6e 20 62 65 20 69 6d | Doors c|an be im|
|000040f0| 70 6c 65 6d 65 6e 74 65 | 64 0d 0a 75 73 69 6e 67 |plemente|d..using|
|00004100| 20 65 78 61 63 74 6c 79 | 20 74 68 65 20 73 61 6d | exactly| the sam|
|00004110| 65 20 6d 65 63 68 61 6e | 69 73 6d 73 20 73 68 6f |e mechan|isms sho|
|00004120| 77 6e 20 61 62 6f 76 65 | 20 66 6f 72 20 74 68 65 |wn above| for the|
|00004130| 20 73 74 61 69 72 77 61 | 79 3a 0d 0a 69 6e 20 74 | stairwa|y:..in t|
|00004140| 68 65 20 64 69 72 65 63 | 74 69 6f 6e 61 6c 20 70 |he direc|tional p|
|00004150| 72 6f 70 65 72 74 69 65 | 73 20 66 6f 72 20 74 68 |ropertie|s for th|
|00004160| 65 20 72 6f 6f 6d 73 20 | 69 6e 76 6f 6c 76 69 6e |e rooms |involvin|
|00004170| 67 20 74 68 65 20 64 6f | 6f 72 2c 0d 0a 63 68 65 |g the do|or,..che|
|00004180| 63 6b 20 74 68 65 20 73 | 74 61 74 75 73 20 6f 66 |ck the s|tatus of|
|00004190| 20 74 68 65 20 64 6f 6f | 72 20 6f 62 6a 65 63 74 | the doo|r object|
|000041a0| 20 28 67 65 6e 65 72 61 | 6c 6c 79 20 74 68 65 20 | (genera|lly the |
|000041b0| 7b 5c 74 74 20 69 73 6f | 70 65 6e 7d 0d 0a 70 72 |{\tt iso|pen}..pr|
|000041c0| 6f 70 65 72 74 79 29 2c | 20 61 6e 64 20 65 69 74 |operty),| and eit|
|000041d0| 68 65 72 20 72 65 74 75 | 72 6e 20 61 20 72 6f 6f |her retu|rn a roo|
|000041e0| 6d 20 6f 62 6a 65 63 74 | 20 69 66 20 74 68 65 20 |m object| if the |
|000041f0| 64 6f 6f 72 20 69 73 20 | 6f 70 65 6e 2c 0d 0a 6f |door is |open,..o|
|00004200| 72 20 64 69 73 70 6c 61 | 79 20 61 20 6d 65 73 73 |r displa|y a mess|
|00004210| 61 67 65 20 61 6e 64 20 | 72 65 74 75 72 6e 20 7b |age and |return {|
|00004220| 5c 74 74 20 6e 69 6c 7d | 20 69 66 20 74 68 65 20 |\tt nil}| if the |
|00004230| 64 6f 6f 72 20 69 73 20 | 63 6c 6f 73 65 64 2e 0d |door is |closed..|
|00004240| 0a 54 68 69 73 20 74 79 | 70 65 20 6f 66 20 6d 65 |.This ty|pe of me|
|00004250| 63 68 61 6e 69 73 6d 20 | 69 73 20 75 73 65 64 20 |chanism |is used |
|00004260| 69 6e 20 7b 5c 74 74 20 | 44 49 54 43 48 2e 54 7d |in {\tt |DITCH.T}|
|00004270| 20 66 6f 72 20 69 74 73 | 20 64 6f 6f 72 73 2e 0d | for its| doors..|
|00004280| 0a 0d 0a 48 6f 77 65 76 | 65 72 2c 20 7b 5c 74 74 |...Howev|er, {\tt|
|00004290| 20 61 64 76 2e 74 7d 20 | 70 72 6f 76 69 64 65 73 | adv.t} |provides|
|000042a0| 20 61 20 73 65 74 20 6f | 66 20 63 6c 61 73 73 65 | a set o|f classe|
|000042b0| 73 20 74 68 61 74 20 6d | 61 6b 65 73 20 69 74 0d |s that m|akes it.|
|000042c0| 0a 65 61 73 69 65 72 20 | 74 6f 20 69 6d 70 6c 65 |.easier |to imple|
|000042d0| 6d 65 6e 74 20 64 6f 6f | 72 73 2e 20 20 54 68 65 |ment doo|rs. The|
|000042e0| 20 63 6c 61 73 73 65 73 | 20 61 72 65 20 62 61 73 | classes| are bas|
|000042f0| 65 64 20 6f 6e 20 61 20 | 67 65 6e 65 72 61 6c 0d |ed on a |general.|
|00004300| 0a 63 6c 61 73 73 20 63 | 61 6c 6c 65 64 20 7b 5c |.class c|alled {\|
|00004310| 74 74 20 6f 62 73 74 61 | 63 6c 65 7d 20 28 77 68 |tt obsta|cle} (wh|
|00004320| 69 63 68 20 79 6f 75 20 | 6d 61 79 20 77 69 73 68 |ich you |may wish|
|00004330| 20 74 6f 20 65 78 74 65 | 6e 64 20 69 6e 74 6f 0d | to exte|nd into.|
|00004340| 0a 79 6f 75 72 20 6f 77 | 6e 20 73 70 65 63 69 61 |.your ow|n specia|
|00004350| 6c 69 7a 65 64 20 63 6c | 61 73 73 65 73 20 74 6f |lized cl|asses to|
|00004360| 20 69 6d 70 6c 65 6d 65 | 6e 74 20 64 69 66 66 65 | impleme|nt diffe|
|00004370| 72 65 6e 74 20 74 79 70 | 65 73 20 6f 66 0d 0a 6f |rent typ|es of..o|
|00004380| 62 73 74 61 63 6c 65 73 | 29 2e 20 20 54 68 65 20 |bstacles|). The |
|00004390| 62 61 73 69 63 20 63 6c | 61 73 73 20 69 73 20 7b |basic cl|ass is {|
|000043a0| 5c 74 74 20 64 6f 6f 72 | 77 61 79 7d 2c 20 61 6e |\tt door|way}, an|
|000043b0| 64 20 61 6e 20 61 64 64 | 69 74 69 6f 6e 61 6c 0d |d an add|itional.|
|000043c0| 0a 63 6c 61 73 73 20 63 | 61 6c 6c 65 64 20 7b 5c |.class c|alled {\|
|000043d0| 74 74 20 6c 6f 63 6b 61 | 62 6c 65 44 6f 6f 72 77 |tt locka|bleDoorw|
|000043e0| 61 79 7d 20 6d 61 6b 65 | 73 20 69 74 20 65 61 73 |ay} make|s it eas|
|000043f0| 79 20 74 6f 20 69 6d 70 | 6c 65 6d 65 6e 74 20 61 |y to imp|lement a|
|00004400| 0d 0a 64 6f 6f 72 20 74 | 68 61 74 20 63 61 6e 20 |..door t|hat can |
|00004410| 62 65 20 6c 6f 63 6b 65 | 64 20 61 6e 64 20 75 6e |be locke|d and un|
|00004420| 6c 6f 63 6b 65 64 20 77 | 69 74 68 20 61 20 70 61 |locked w|ith a pa|
|00004430| 72 74 69 63 75 6c 61 72 | 20 6b 65 79 20 6f 62 6a |rticular| key obj|
|00004440| 65 63 74 2e 0d 0a 0d 0a | 42 79 20 75 73 69 6e 67 |ect.....|By using|
|00004450| 20 74 68 65 20 7b 5c 74 | 74 20 64 6f 6f 72 77 61 | the {\t|t doorwa|
|00004460| 79 7d 20 61 6e 64 20 7b | 5c 74 74 20 6c 6f 63 6b |y} and {|\tt lock|
|00004470| 65 64 44 6f 6f 72 77 61 | 79 7d 20 63 6c 61 73 73 |edDoorwa|y} class|
|00004480| 65 73 2c 20 79 6f 75 0d | 0a 63 61 6e 20 69 6d 70 |es, you.|.can imp|
|00004490| 6c 65 6d 65 6e 74 20 64 | 6f 6f 72 73 20 77 69 74 |lement d|oors wit|
|000044a0| 68 20 6e 6f 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |h no pro|gramming|
|000044b0| 2c 20 62 65 63 61 75 73 | 65 20 74 68 65 20 62 61 |, becaus|e the ba|
|000044c0| 73 69 63 20 74 72 61 76 | 65 6c 0d 0a 72 6f 75 74 |sic trav|el..rout|
|000044d0| 69 6e 65 73 20 77 69 6c | 6c 20 64 6f 20 74 68 65 |ines wil|l do the|
|000044e0| 20 6e 65 63 65 73 73 61 | 72 79 20 77 6f 72 6b 20 | necessa|ry work |
|000044f0| 62 61 73 65 64 20 6f 6e | 20 70 72 6f 70 65 72 74 |based on| propert|
|00004500| 69 65 73 20 64 65 66 69 | 6e 65 64 0d 0a 69 6e 20 |ies defi|ned..in |
|00004510| 79 6f 75 72 20 64 6f 6f | 72 77 61 79 20 6f 62 6a |your doo|rway obj|
|00004520| 65 63 74 73 2e 0d 0a 0d | 0a 54 68 65 20 66 69 72 |ects....|.The fir|
|00004530| 73 74 20 74 68 69 6e 67 | 20 74 6f 20 6e 6f 74 65 |st thing| to note|
|00004540| 20 61 62 6f 75 74 20 64 | 6f 6f 72 73 20 69 73 20 | about d|oors is |
|00004550| 74 68 61 74 20 74 68 65 | 79 20 68 61 76 65 20 61 |that the|y have a|
|00004560| 6e 20 75 6e 75 73 75 61 | 6c 0d 0a 70 72 6f 70 65 |n unusua|l..prope|
|00004570| 72 74 79 3a 20 20 61 20 | 64 6f 6f 72 20 65 78 69 |rty: a |door exi|
|00004580| 73 74 73 20 69 6e 20 74 | 77 6f 20 72 6f 6f 6d 73 |sts in t|wo rooms|
|00004590| 2c 20 62 65 63 61 75 73 | 65 20 69 74 20 63 6f 6e |, becaus|e it con|
|000045a0| 6e 65 63 74 73 20 74 68 | 65 0d 0a 74 77 6f 20 72 |nects th|e..two r|
|000045b0| 6f 6f 6d 73 2e 20 20 55 | 6e 66 6f 72 74 75 6e 61 |ooms. U|nfortuna|
|000045c0| 74 65 6c 79 2c 20 54 41 | 44 53 20 64 6f 65 73 6e |tely, TA|DS doesn|
|000045d0| 27 74 20 68 61 76 65 20 | 61 6e 79 20 67 6f 6f 64 |'t have |any good|
|000045e0| 20 77 61 79 20 6f 66 0d | 0a 70 75 74 74 69 6e 67 | way of.|.putting|
|000045f0| 20 61 20 73 69 6e 67 6c | 65 20 6f 62 6a 65 63 74 | a singl|e object|
|00004600| 20 69 6e 20 6d 75 6c 74 | 69 70 6c 65 20 6c 6f 63 | in mult|iple loc|
|00004610| 61 74 69 6f 6e 73 2e 20 | 20 54 6f 20 77 6f 72 6b |ations. | To work|
|00004620| 20 61 72 6f 75 6e 64 0d | 0a 74 68 69 73 20 70 72 | around.|.this pr|
|00004630| 6f 62 6c 65 6d 2c 20 79 | 6f 75 20 73 68 6f 75 6c |oblem, y|ou shoul|
|00004640| 64 20 6d 61 6b 65 20 7b | 5c 69 74 20 74 77 6f 7d |d make {|\it two}|
|00004650| 20 6f 62 6a 65 63 74 73 | 20 66 6f 72 20 65 61 63 | objects| for eac|
|00004660| 68 20 61 63 74 75 61 6c | 0d 0a 64 6f 6f 72 20 69 |h actual|..door i|
|00004670| 6e 20 79 6f 75 72 20 67 | 61 6d 65 3a 20 20 6f 6e |n your g|ame: on|
|00004680| 65 20 66 6f 72 20 65 61 | 63 68 20 73 69 64 65 2e |e for ea|ch side.|
|00004690| 20 20 46 6f 72 74 75 6e | 61 74 65 6c 79 2c 20 74 | Fortun|ately, t|
|000046a0| 68 65 20 7b 5c 74 74 20 | 64 6f 6f 72 77 61 79 7d |he {\tt |doorway}|
|000046b0| 0d 0a 63 6c 61 73 73 20 | 6d 61 6b 65 73 20 69 74 |..class |makes it|
|000046c0| 20 65 61 73 79 20 74 6f | 20 6b 65 65 70 20 74 68 | easy to| keep th|
|000046d0| 65 20 73 74 61 74 65 73 | 20 6f 66 20 74 68 65 20 |e states| of the |
|000046e0| 74 77 6f 20 6f 62 6a 65 | 63 74 73 0d 0a 73 79 6e |two obje|cts..syn|
|000046f0| 63 68 72 6f 6e 69 7a 65 | 64 3a 20 20 66 6f 72 20 |chronize|d: for |
|00004700| 65 78 61 6d 70 6c 65 2c | 20 77 68 65 6e 20 79 6f |example,| when yo|
|00004710| 75 20 6f 70 65 6e 20 6f | 6e 65 20 73 69 64 65 20 |u open o|ne side |
|00004720| 6f 66 20 74 68 65 20 64 | 6f 6f 72 2c 20 74 68 65 |of the d|oor, the|
|00004730| 0d 0a 6f 74 68 65 72 20 | 73 69 64 65 20 69 73 20 |..other |side is |
|00004740| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 6f 70 |automati|cally op|
|00004750| 65 6e 65 64 2e 0d 0a 0d | 0a 53 74 61 72 74 20 62 |ened....|.Start b|
|00004760| 79 20 69 6d 70 6c 65 6d | 65 6e 74 69 6e 67 20 74 |y implem|enting t|
|00004770| 68 65 20 74 77 6f 20 73 | 69 64 65 73 20 6f 66 20 |he two s|ides of |
|00004780| 74 68 65 20 64 6f 6f 72 | 2e 20 20 20 4d 61 6b 65 |the door|. Make|
|00004790| 20 61 20 7b 5c 74 74 20 | 64 6f 6f 72 77 61 79 7d | a {\tt |doorway}|
|000047a0| 0d 0a 6f 62 6a 65 63 74 | 20 66 6f 72 20 65 61 63 |..object| for eac|
|000047b0| 68 2c 20 66 69 6c 6c 69 | 6e 67 20 69 6e 20 74 68 |h, filli|ng in th|
|000047c0| 65 20 6e 6f 72 6d 61 6c | 20 70 72 6f 70 65 72 74 |e normal| propert|
|000047d0| 69 65 73 20 66 6f 72 20 | 61 6e 79 20 6f 62 6a 65 |ies for |any obje|
|000047e0| 63 74 0d 0a 28 7b 5c 74 | 74 20 6c 6f 63 61 74 69 |ct..({\t|t locati|
|000047f0| 6f 6e 7d 2c 20 7b 5c 74 | 74 20 73 64 65 73 63 7d |on}, {\t|t sdesc}|
|00004800| 2c 20 7b 5c 74 74 20 6e | 6f 75 6e 7d 29 2e 20 20 |, {\tt n|oun}). |
|00004810| 50 75 74 20 6f 6e 65 20 | 7b 5c 74 74 20 64 6f 6f |Put one |{\tt doo|
|00004820| 72 77 61 79 7d 0d 0a 6f | 62 6a 65 63 74 20 69 6e |rway}..o|bject in|
|00004830| 20 65 61 63 68 20 72 6f | 6f 6d 20 74 6f 20 62 65 | each ro|om to be|
|00004840| 20 63 6f 6e 6e 65 63 74 | 65 64 2e 20 20 4e 6f 77 | connect|ed. Now|
|00004850| 20 61 64 64 20 74 68 65 | 20 73 70 65 63 69 61 6c | add the| special|
|00004860| 20 70 72 6f 70 65 72 74 | 69 65 73 0d 0a 66 6f 72 | propert|ies..for|
|00004870| 20 61 20 64 6f 6f 72 77 | 61 79 2e 20 20 53 65 74 | a doorw|ay. Set|
|00004880| 20 7b 5c 74 74 20 6f 74 | 68 65 72 73 69 64 65 7d | {\tt ot|herside}|
|00004890| 20 74 6f 20 74 68 65 20 | 6f 74 68 65 72 20 64 6f | to the |other do|
|000048a0| 6f 72 20 6f 62 6a 65 63 | 74 20 6d 61 6b 69 6e 67 |or objec|t making|
|000048b0| 0d 0a 75 70 20 74 68 65 | 20 70 61 69 72 20 6f 66 |..up the| pair of|
|000048c0| 20 64 6f 6f 72 73 3b 20 | 74 68 69 73 20 69 73 20 | doors; |this is |
|000048d0| 68 6f 77 20 74 68 65 20 | 64 6f 6f 72 27 73 20 69 |how the |door's i|
|000048e0| 6e 74 65 72 6e 61 6c 20 | 72 6f 75 74 69 6e 65 73 |nternal |routines|
|000048f0| 20 6b 6e 6f 77 0d 0a 77 | 68 61 74 20 6f 74 68 65 | know..w|hat othe|
|00004900| 72 20 64 6f 6f 72 20 74 | 6f 20 6b 65 65 70 20 73 |r door t|o keep s|
|00004910| 79 6e 63 68 72 6f 6e 69 | 7a 65 64 2e 20 20 53 65 |ynchroni|zed. Se|
|00004920| 74 20 7b 5c 74 74 20 64 | 6f 6f 72 64 65 73 74 7d |t {\tt d|oordest}|
|00004930| 20 74 6f 20 74 68 65 0d | 0a 72 6f 6f 6d 20 6f 62 | to the.|.room ob|
|00004940| 6a 65 63 74 20 74 68 61 | 74 27 73 20 72 65 61 63 |ject tha|t's reac|
|00004950| 68 65 64 20 62 79 20 74 | 72 61 76 65 6c 6c 69 6e |hed by t|ravellin|
|00004960| 67 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 64 6f |g throug|h the do|
|00004970| 6f 72 2e 0d 0a 0d 0a 54 | 68 65 6e 2c 20 61 6c 6c |or.....T|hen, all|
|00004980| 20 79 6f 75 20 6e 65 65 | 64 20 74 6f 20 64 6f 20 | you nee|d to do |
|00004990| 66 6f 72 20 74 68 65 20 | 72 6f 6f 6d 73 20 63 6f |for the |rooms co|
|000049a0| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 64 6f 6f |ntaining| the doo|
|000049b0| 72 73 20 69 73 0d 0a 74 | 6f 20 73 65 74 20 74 68 |rs is..t|o set th|
|000049c0| 65 20 64 69 72 65 63 74 | 69 6f 6e 20 70 72 6f 70 |e direct|ion prop|
|000049d0| 65 72 74 69 65 73 20 74 | 6f 20 74 68 65 20 64 6f |erties t|o the do|
|000049e0| 6f 72 73 20 74 68 65 6d | 73 65 6c 76 65 73 2c 20 |ors them|selves, |
|000049f0| 72 61 74 68 65 72 0d 0a | 74 68 61 6e 20 74 68 65 |rather..|than the|
|00004a00| 20 72 6f 6f 6d 73 20 72 | 65 61 63 68 65 64 20 74 | rooms r|eached t|
|00004a10| 68 72 6f 75 67 68 20 74 | 68 65 20 64 6f 6f 72 73 |hrough t|he doors|
|00004a20| 2e 20 20 48 65 72 65 27 | 73 20 61 6e 20 65 78 61 |. Here'|s an exa|
|00004a30| 6d 70 6c 65 2c 0d 0a 73 | 68 6f 77 69 6e 67 20 74 |mple,..s|howing t|
|00004a40| 68 65 20 74 77 6f 20 72 | 6f 6f 6d 20 6f 62 6a 65 |he two r|oom obje|
|00004a50| 63 74 73 20 61 6e 64 20 | 74 68 65 20 74 77 6f 20 |cts and |the two |
|00004a60| 64 6f 6f 72 20 6f 62 6a | 65 63 74 73 2e 0d 0a 0d |door obj|ects....|
|00004a70| 0a 7b 5c 65 78 61 6d 70 | 6c 65 0d 0a 5c 6f 62 6a |.{\examp|le..\obj|
|00004a80| 65 63 74 7b 70 6f 72 63 | 68 3a 20 72 6f 6f 6d 7d |ect{porc|h: room}|
|00004a90| 0d 0a 20 20 20 20 73 64 | 65 73 63 20 3d 20 22 50 |.. sd|esc = "P|
|00004aa0| 6f 72 63 68 22 0d 0a 20 | 20 20 20 6c 64 65 73 63 |orch".. | ldesc|
|00004ab0| 20 3d 20 22 59 6f 75 27 | 72 65 20 6f 6e 20 61 20 | = "You'|re on a |
|00004ac0| 70 6f 72 63 68 20 6f 75 | 74 73 69 64 65 20 61 20 |porch ou|tside a |
|00004ad0| 68 75 67 65 20 72 75 6e | 2d 64 6f 77 6e 20 77 6f |huge run|-down wo|
|00004ae0| 6f 64 65 6e 20 68 6f 75 | 73 65 0d 0a 20 20 20 20 |oden hou|se.. |
|00004af0| 20 20 20 20 20 20 20 20 | 74 68 61 74 20 77 61 73 | |that was|
|00004b00| 20 70 72 6f 62 61 62 6c | 79 20 70 61 69 6e 74 65 | probabl|y painte|
|00004b10| 64 20 77 68 69 74 65 20 | 69 6e 20 74 68 65 20 64 |d white |in the d|
|00004b20| 69 73 74 61 6e 74 20 70 | 61 73 74 2c 0d 0a 20 20 |istant p|ast,.. |
|00004b30| 20 20 20 20 20 20 20 20 | 20 20 62 75 74 20 77 68 | | but wh|
|00004b40| 69 63 68 20 69 73 20 67 | 72 61 79 20 61 6e 64 20 |ich is g|ray and |
|00004b50| 66 61 64 65 64 20 6e 6f | 77 2e 20 20 41 20 64 6f |faded no|w. A do|
|00004b60| 6f 72 20 28 77 68 69 63 | 68 20 69 73 0d 0a 20 20 |or (whic|h is.. |
|00004b70| 20 20 20 20 20 20 20 20 | 20 20 3c 3c 20 70 6f 72 | | << por|
|00004b80| 63 68 44 6f 6f 72 2e 69 | 73 6f 70 65 6e 20 3f 20 |chDoor.i|sopen ? |
|00004b90| 22 6f 70 65 6e 22 20 3a | 20 22 63 6c 6f 73 65 64 |"open" :| "closed|
|00004ba0| 22 20 3e 3e 29 20 6c 65 | 61 64 73 20 77 65 73 74 |" >>) le|ads west|
|00004bb0| 2e 22 0d 0a 20 20 20 20 | 77 65 73 74 20 3d 20 70 |.".. |west = p|
|00004bc0| 6f 72 63 68 44 6f 6f 72 | 20 20 20 20 20 20 20 20 |orchDoor| |
|00004bd0| 20 20 20 20 20 20 20 20 | 20 20 20 5c 68 66 69 6c | | \hfil|
|00004be0| 6c 20 2f 2a 20 75 73 65 | 20 64 6f 6f 72 20 66 6f |l /* use| door fo|
|00004bf0| 72 20 74 68 65 20 64 69 | 72 65 63 74 69 6f 6e 20 |r the di|rection |
|00004c00| 2a 2f 0d 0a 5c 65 6e 64 | 6f 62 6a 0d 0a 0d 0a 5c |*/..\end|obj....\|
|00004c10| 76 73 6b 69 70 31 32 70 | 74 0d 0a 5c 6f 62 6a 65 |vskip12p|t..\obje|
|00004c20| 63 74 7b 66 72 6f 6e 74 | 48 61 6c 6c 3a 20 72 6f |ct{front|Hall: ro|
|00004c30| 6f 6d 7d 0d 0a 20 20 20 | 20 73 64 65 73 63 20 3d |om}.. | sdesc =|
|00004c40| 20 22 46 72 6f 6e 74 20 | 48 61 6c 6c 22 0d 0a 20 | "Front |Hall".. |
|00004c50| 20 20 20 6c 64 65 73 63 | 20 3d 20 22 59 6f 75 27 | ldesc| = "You'|
|00004c60| 72 65 20 69 6e 20 74 68 | 65 20 73 70 61 63 69 6f |re in th|e spacio|
|00004c70| 75 73 20 66 72 6f 6e 74 | 20 68 61 6c 6c 77 61 79 |us front| hallway|
|00004c80| 20 6f 66 20 74 68 65 20 | 6f 6c 64 20 68 6f 75 73 | of the |old hous|
|00004c90| 65 2e 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |e... | |
|00004ca0| 54 68 65 20 70 61 69 6e | 74 20 6f 6e 20 74 68 65 |The pain|t on the|
|00004cb0| 20 77 61 6c 6c 73 20 69 | 73 20 61 6c 6c 20 70 65 | walls i|s all pe|
|00004cc0| 65 6c 69 6e 67 2c 20 61 | 6e 64 20 61 20 74 68 69 |eling, a|nd a thi|
|00004cd0| 63 6b 20 76 65 69 6c 0d | 0a 20 20 20 20 20 20 20 |ck veil.|. |
|00004ce0| 20 20 20 20 20 6f 66 20 | 73 70 69 64 65 72 77 65 | of |spiderwe|
|00004cf0| 62 73 20 68 61 6e 67 73 | 20 64 6f 77 6e 20 66 72 |bs hangs| down fr|
|00004d00| 6f 6d 20 74 68 65 20 63 | 65 69 6c 69 6e 67 2e 20 |om the c|eiling. |
|00004d10| 20 41 20 64 6f 6f 72 0d | 0a 20 20 20 20 20 20 20 | A door.|. |
|00004d20| 20 20 20 20 20 28 77 68 | 69 63 68 20 69 73 20 3c | (wh|ich is <|
|00004d30| 3c 68 61 6c 6c 44 6f 6f | 72 2e 69 73 6f 70 65 6e |<hallDoo|r.isopen|
|00004d40| 20 3f 20 22 6f 70 65 6e | 22 20 3a 20 22 63 6c 6f | ? "open|" : "clo|
|00004d50| 73 65 64 22 3e 3e 29 0d | 0a 20 20 20 20 20 20 20 |sed">>).|. |
|00004d60| 20 20 20 20 20 6c 65 61 | 64 73 20 65 61 73 74 2e | lea|ds east.|
|00004d70| 22 0d 0a 20 20 20 20 65 | 61 73 74 20 3d 20 68 61 |".. e|ast = ha|
|00004d80| 6c 6c 44 6f 6f 72 0d 0a | 5c 65 6e 64 6f 62 6a 0d |llDoor..|\endobj.|
|00004d90| 0a 0d 0a 5c 76 73 6b 69 | 70 31 32 70 74 0d 0a 5c |...\vski|p12pt..\|
|00004da0| 6f 62 6a 65 63 74 7b 70 | 6f 72 63 68 44 6f 6f 72 |object{p|orchDoor|
|00004db0| 3a 20 64 6f 6f 72 77 61 | 79 7d 0d 0a 20 20 20 20 |: doorwa|y}.. |
|00004dc0| 6c 6f 63 61 74 69 6f 6e | 20 3d 20 70 6f 72 63 68 |location| = porch|
|00004dd0| 0d 0a 20 20 20 20 6e 6f | 75 6e 20 3d 20 27 64 6f |.. no|un = 'do|
|00004de0| 6f 72 27 0d 0a 20 20 20 | 20 73 64 65 73 63 20 3d |or'.. | sdesc =|
|00004df0| 20 22 64 6f 6f 72 22 0d | 0a 20 20 20 20 6f 74 68 | "door".|. oth|
|00004e00| 65 72 73 69 64 65 20 3d | 20 68 61 6c 6c 44 6f 6f |erside =| hallDoo|
|00004e10| 72 0d 0a 20 20 20 20 64 | 6f 6f 72 64 65 73 74 20 |r.. d|oordest |
|00004e20| 3d 20 66 72 6f 6e 74 48 | 61 6c 6c 0d 0a 5c 65 6e |= frontH|all..\en|
|00004e30| 64 6f 62 6a 0d 0a 0d 0a | 5c 76 73 6b 69 70 31 32 |dobj....|\vskip12|
|00004e40| 70 74 0d 0a 5c 6f 62 6a | 65 63 74 7b 68 61 6c 6c |pt..\obj|ect{hall|
|00004e50| 44 6f 6f 72 3a 20 64 6f | 6f 72 77 61 79 7d 0d 0a |Door: do|orway}..|
|00004e60| 20 20 20 20 6c 6f 63 61 | 74 69 6f 6e 20 3d 20 66 | loca|tion = f|
|00004e70| 72 6f 6e 74 48 61 6c 6c | 0d 0a 20 20 20 20 6e 6f |rontHall|.. no|
|00004e80| 75 6e 20 3d 20 27 64 6f | 6f 72 27 0d 0a 20 20 20 |un = 'do|or'.. |
|00004e90| 20 73 64 65 73 63 20 3d | 20 22 64 6f 6f 72 22 0d | sdesc =| "door".|
|00004ea0| 0a 20 20 20 20 6f 74 68 | 65 72 73 69 64 65 20 3d |. oth|erside =|
|00004eb0| 20 70 6f 72 63 68 44 6f | 6f 72 0d 0a 20 20 20 20 | porchDo|or.. |
|00004ec0| 64 6f 6f 72 64 65 73 74 | 20 3d 20 70 6f 72 63 68 |doordest| = porch|
|00004ed0| 0d 0a 5c 65 6e 64 6f 62 | 6a 0d 0a 7d 0d 0a 0d 0a |..\endob|j..}....|
|00004ee0| 4e 6f 74 65 20 74 68 61 | 74 20 74 68 65 72 65 27 |Note tha|t there'|
|00004ef0| 73 20 6e 6f 20 6e 65 65 | 64 20 74 6f 20 64 65 66 |s no nee|d to def|
|00004f00| 69 6e 65 20 7b 5c 74 74 | 20 6c 64 65 73 63 7d 20 |ine {\tt| ldesc} |
|00004f10| 66 6f 72 20 61 20 64 6f | 6f 72 77 61 79 2c 20 75 |for a do|orway, u|
|00004f20| 6e 6c 65 73 73 0d 0a 79 | 6f 75 20 77 61 6e 74 20 |nless..y|ou want |
|00004f30| 74 6f 2e 20 20 54 68 65 | 20 64 65 66 61 75 6c 74 |to. The| default|
|00004f40| 20 7b 5c 74 74 20 6c 64 | 65 73 63 7d 20 64 65 66 | {\tt ld|esc} def|
|00004f50| 69 6e 65 64 20 69 6e 20 | 74 68 65 20 7b 5c 74 74 |ined in |the {\tt|
|00004f60| 20 64 6f 6f 72 77 61 79 | 7d 0d 0a 6f 62 6a 65 63 | doorway|}..objec|
|00004f70| 74 20 64 69 73 70 6c 61 | 79 73 20 61 20 6d 65 73 |t displa|ys a mes|
|00004f80| 73 61 67 65 20 73 61 79 | 69 6e 67 20 73 69 6d 70 |sage say|ing simp|
|00004f90| 6c 79 20 60 60 49 74 27 | 73 20 6f 70 65 6e 27 27 |ly ``It'|s open''|
|00004fa0| 20 6f 72 20 60 60 49 74 | 27 73 20 63 6c 6f 73 65 | or ``It|'s close|
|00004fb0| 64 27 27 0d 0a 6f 72 20 | 60 60 49 74 27 73 20 63 |d''..or |``It's c|
|00004fc0| 6c 6f 73 65 64 20 61 6e | 64 20 6c 6f 63 6b 65 64 |losed an|d locked|
|00004fd0| 2c 27 27 20 64 65 70 65 | 6e 64 69 6e 67 20 6f 6e |,'' depe|nding on|
|00004fe0| 20 74 68 65 20 64 6f 6f | 72 27 73 20 73 74 61 74 | the doo|r's stat|
|00004ff0| 65 2e 20 20 49 66 20 79 | 6f 75 0d 0a 77 61 6e 74 |e. If y|ou..want|
|00005000| 20 74 6f 20 6f 76 65 72 | 72 69 64 65 20 7b 5c 74 | to over|ride {\t|
|00005010| 74 20 6c 64 65 73 63 7d | 2c 20 79 6f 75 20 63 61 |t ldesc}|, you ca|
|00005020| 6e 20 75 73 65 20 74 68 | 65 20 7b 5c 74 74 20 69 |n use th|e {\tt i|
|00005030| 73 6f 70 65 6e 7d 0d 0a | 61 6e 64 20 7b 5c 74 74 |sopen}..|and {\tt|
|00005040| 20 69 73 6c 6f 63 6b 65 | 64 7d 20 70 72 6f 70 65 | islocke|d} prope|
|00005050| 72 74 69 65 73 20 74 6f | 20 64 65 74 65 72 6d 69 |rties to| determi|
|00005060| 6e 65 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |ne the s|tate of |
|00005070| 74 68 65 20 64 6f 6f 72 | 0d 0a 74 6f 20 62 65 20 |the door|..to be |
|00005080| 64 69 73 70 6c 61 79 65 | 64 20 69 6e 20 79 6f 75 |displaye|d in you|
|00005090| 72 20 63 75 73 74 6f 6d | 20 6d 65 73 73 61 67 65 |r custom| message|
|000050a0| 2e 0d 0a 0d 0a 53 6f 6d | 65 20 6d 6f 72 65 20 70 |.....Som|e more p|
|000050b0| 72 6f 70 65 72 74 69 65 | 73 20 6f 66 20 74 68 65 |ropertie|s of the|
|000050c0| 20 7b 5c 74 74 20 64 6f | 6f 72 77 61 79 7d 20 63 | {\tt do|orway} c|
|000050d0| 6c 61 73 73 20 61 72 65 | 20 77 6f 72 74 68 20 6d |lass are| worth m|
|000050e0| 65 6e 74 69 6f 6e 69 6e | 67 2e 0d 0a 49 66 20 74 |entionin|g...If t|
|000050f0| 68 65 20 64 6f 6f 72 20 | 69 73 20 6e 6f 74 20 6c |he door |is not l|
|00005100| 6f 63 6b 65 64 2c 20 74 | 68 65 20 64 6f 6f 72 20 |ocked, t|he door |
|00005110| 77 69 6c 6c 20 62 65 20 | 6f 70 65 6e 65 64 20 7b |will be |opened {|
|00005120| 5c 69 74 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c |\it auto|maticall|
|00005130| 79 7d 0d 0a 77 68 65 6e | 20 74 68 65 20 70 6c 61 |y}..when| the pla|
|00005140| 79 65 72 20 74 72 69 65 | 73 20 74 6f 20 74 72 61 |yer trie|s to tra|
|00005150| 76 65 6c 20 74 68 72 6f | 75 67 68 20 69 74 20 28 |vel thro|ugh it (|
|00005160| 73 75 63 68 20 61 73 20 | 62 79 20 67 6f 69 6e 67 |such as |by going|
|00005170| 20 77 65 73 74 20 66 72 | 6f 6d 0d 0a 74 68 65 20 | west fr|om..the |
|00005180| 70 6f 72 63 68 20 69 6e | 20 74 68 65 20 65 78 61 |porch in| the exa|
|00005190| 6d 70 6c 65 20 61 62 6f | 76 65 29 2e 20 20 54 68 |mple abo|ve). Th|
|000051a0| 69 73 20 6d 61 6b 65 73 | 20 74 68 65 20 67 61 6d |is makes| the gam|
|000051b0| 65 20 6d 6f 72 65 20 63 | 6f 6e 76 65 6e 69 65 6e |e more c|onvenien|
|000051c0| 74 2c 0d 0a 62 65 63 61 | 75 73 65 20 69 74 27 73 |t,..beca|use it's|
|000051d0| 20 6e 6f 74 20 6e 65 63 | 65 73 73 61 72 79 20 74 | not nec|essary t|
|000051e0| 6f 20 74 79 70 65 20 60 | 60 6f 70 65 6e 20 74 68 |o type `|`open th|
|000051f0| 65 20 64 6f 6f 72 27 27 | 20 77 68 65 6e 20 74 68 |e door''| when th|
|00005200| 61 74 27 73 20 74 68 65 | 0d 0a 6f 62 76 69 6f 75 |at's the|..obviou|
|00005210| 73 20 74 68 69 6e 67 20 | 74 6f 20 64 6f 2e 20 20 |s thing |to do. |
|00005220| 48 6f 77 65 76 65 72 2c | 20 69 6e 20 63 61 73 65 |However,| in case|
|00005230| 73 20 77 68 65 72 65 20 | 79 6f 75 20 64 6f 6e 27 |s where |you don'|
|00005240| 74 20 77 61 6e 74 20 61 | 20 64 6f 6f 72 0d 0a 74 |t want a| door..t|
|00005250| 6f 20 62 65 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |o be aut|omatical|
|00005260| 6c 79 20 6f 70 65 6e 65 | 64 2c 20 79 6f 75 20 63 |ly opene|d, you c|
|00005270| 61 6e 20 73 69 6d 70 6c | 79 20 61 64 64 20 7b 5c |an simpl|y add {\|
|00005280| 74 74 20 6e 6f 41 75 74 | 6f 4f 70 65 6e 20 3d 20 |tt noAut|oOpen = |
|00005290| 74 72 75 65 7d 0d 0a 74 | 6f 20 74 68 65 20 7b 5c |true}..t|o the {\|
|000052a0| 74 74 20 64 6f 6f 72 77 | 61 79 7d 20 6f 62 6a 65 |tt doorw|ay} obje|
|000052b0| 63 74 27 73 20 70 72 6f | 70 65 72 74 69 65 73 3b |ct's pro|perties;|
|000052c0| 20 74 68 69 73 20 72 65 | 71 75 69 72 65 73 20 74 | this re|quires t|
|000052d0| 68 65 20 70 6c 61 79 65 | 72 0d 0a 74 6f 20 65 78 |he playe|r..to ex|
|000052e0| 70 6c 69 63 69 74 6c 79 | 20 6f 70 65 6e 20 74 68 |plicitly| open th|
|000052f0| 65 20 64 6f 6f 72 2c 20 | 65 76 65 6e 20 77 68 65 |e door, |even whe|
|00005300| 6e 20 69 74 27 73 20 6e | 6f 74 20 6c 6f 63 6b 65 |n it's n|ot locke|
|00005310| 64 2e 0d 0a 0d 0a 5e 5e | 7b 6b 65 79 73 7d 0d 0a |d.....^^|{keys}..|
|00005320| 5e 5e 7b 6c 6f 63 6b 65 | 64 20 64 6f 6f 72 73 7d |^^{locke|d doors}|
|00005330| 0d 0a 49 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |..If you| want to|
|00005340| 20 72 65 71 75 69 72 65 | 20 61 20 6b 65 79 20 74 | require| a key t|
|00005350| 6f 20 6c 6f 63 6b 20 61 | 6e 64 20 75 6e 6c 6f 63 |o lock a|nd unloc|
|00005360| 6b 20 74 68 65 20 64 6f | 6f 72 2c 20 75 73 65 0d |k the do|or, use.|
|00005370| 0a 74 68 65 20 7b 5c 74 | 74 20 6c 6f 63 6b 61 62 |.the {\t|t lockab|
|00005380| 6c 65 44 6f 6f 72 77 61 | 79 7d 20 63 6c 61 73 73 |leDoorwa|y} class|
|00005390| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 7b 5c 74 74 | instead| of {\tt|
|000053a0| 20 64 6f 6f 72 77 61 79 | 7d 2e 20 20 54 68 65 6e | doorway|}. Then|
|000053b0| 2c 0d 0a 61 64 64 20 74 | 68 65 20 7b 5c 74 74 20 |,..add t|he {\tt |
|000053c0| 6d 79 6b 65 79 7d 20 70 | 72 6f 70 65 72 74 79 2c |mykey} p|roperty,|
|000053d0| 20 73 65 74 74 69 6e 67 | 20 69 74 20 74 6f 20 74 | setting| it to t|
|000053e0| 68 65 20 6f 62 6a 65 63 | 74 20 77 68 69 63 68 0d |he objec|t which.|
|000053f0| 0a 73 65 72 76 65 73 20 | 61 73 20 74 68 65 20 6b |.serves |as the k|
|00005400| 65 79 20 28 74 68 69 73 | 20 6f 62 6a 65 63 74 20 |ey (this| object |
|00005410| 73 68 6f 75 6c 64 20 62 | 65 20 6f 66 20 63 6c 61 |should b|e of cla|
|00005420| 73 73 20 7b 5c 74 74 20 | 6b 65 79 49 74 65 6d 7d |ss {\tt |keyItem}|
|00005430| 29 2e 0d 0a 49 66 20 79 | 6f 75 20 64 6f 6e 27 74 |)...If y|ou don't|
|00005440| 20 73 65 74 20 74 68 65 | 20 7b 5c 74 74 20 6d 79 | set the| {\tt my|
|00005450| 6b 65 79 7d 20 70 72 6f | 70 65 72 74 79 2c 20 74 |key} pro|perty, t|
|00005460| 68 65 20 64 6f 6f 72 20 | 63 61 6e 20 62 65 20 6c |he door |can be l|
|00005470| 6f 63 6b 65 64 0d 0a 61 | 6e 64 20 75 6e 6c 6f 63 |ocked..a|nd unloc|
|00005480| 6b 65 64 20 77 69 74 68 | 6f 75 74 20 61 6e 79 20 |ked with|out any |
|00005490| 6b 65 79 3b 20 74 68 61 | 74 20 69 73 2c 20 74 68 |key; tha|t is, th|
|000054a0| 65 20 70 6c 61 79 65 72 | 20 73 69 6d 70 6c 79 20 |e player| simply |
|000054b0| 74 79 70 65 73 0d 0a 60 | 60 6c 6f 63 6b 20 64 6f |types..`|`lock do|
|000054c0| 6f 72 27 27 20 61 6e 64 | 20 60 60 75 6e 6c 6f 63 |or'' and| ``unloc|
|000054d0| 6b 20 64 6f 6f 72 27 27 | 20 74 6f 20 6c 6f 63 6b |k door''| to lock|
|000054e0| 20 61 6e 64 20 75 6e 6c | 6f 63 6b 20 69 74 2e 0d | and unl|ock it..|
|000054f0| 0a 0d 0a 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |...Note |that the|
|00005500| 72 65 27 73 20 6e 6f 20 | 72 65 71 75 69 72 65 6d |re's no |requirem|
|00005510| 65 6e 74 20 74 68 61 74 | 20 74 68 65 20 74 77 6f |ent that| the two|
|00005520| 20 73 69 64 65 73 20 6f | 66 20 61 20 64 6f 6f 72 | sides o|f a door|
|00005530| 0d 0a 62 65 20 69 64 65 | 6e 74 69 63 61 6c 2e 20 |..be ide|ntical. |
|00005540| 20 59 6f 75 20 63 61 6e | 20 74 61 6b 65 20 61 64 | You can| take ad|
|00005550| 76 61 6e 74 61 67 65 20 | 6f 66 20 74 68 69 73 20 |vantage |of this |
|00005560| 69 6e 20 63 65 72 74 61 | 69 6e 0d 0a 73 69 74 75 |in certa|in..situ|
|00005570| 61 74 69 6f 6e 73 2e 20 | 20 46 6f 72 20 65 78 61 |ations. | For exa|
|00005580| 6d 70 6c 65 2c 20 69 66 | 20 79 6f 75 20 77 61 6e |mple, if| you wan|
|00005590| 74 20 74 6f 20 68 61 76 | 65 20 61 20 64 6f 6f 72 |t to hav|e a door|
|000055a0| 20 74 68 61 74 20 6e 65 | 65 64 73 0d 0a 61 20 6b | that ne|eds..a k|
|000055b0| 65 79 20 66 72 6f 6d 20 | 74 68 65 20 6f 75 74 73 |ey from |the outs|
|000055c0| 69 64 65 2c 20 62 75 74 | 20 64 6f 65 73 6e 27 74 |ide, but| doesn't|
|000055d0| 20 6e 65 65 64 20 61 6e | 79 20 6b 65 79 20 66 72 | need an|y key fr|
|000055e0| 6f 6d 20 74 68 65 20 69 | 6e 73 69 64 65 0d 0a 28 |om the i|nside..(|
|000055f0| 6c 69 6b 65 20 6d 6f 73 | 74 20 64 6f 6f 72 73 20 |like mos|t doors |
|00005600| 79 6f 75 27 64 20 66 69 | 6e 64 20 69 6e 20 61 20 |you'd fi|nd in a |
|00005610| 68 6f 75 73 65 29 2c 20 | 6d 61 6b 65 20 62 6f 74 |house), |make bot|
|00005620| 68 20 73 69 64 65 73 0d | 0a 7b 5c 74 74 20 6c 6f |h sides.|.{\tt lo|
|00005630| 63 6b 61 62 6c 65 44 6f | 6f 72 77 61 79 7d 20 6f |ckableDo|orway} o|
|00005640| 62 6a 65 63 74 73 2c 20 | 62 75 74 20 6f 6e 6c 79 |bjects, |but only|
|00005650| 20 73 65 74 20 74 68 65 | 20 7b 5c 74 74 20 6d 79 | set the| {\tt my|
|00005660| 6b 65 79 7d 0d 0a 70 72 | 6f 70 65 72 74 79 20 69 |key}..pr|operty i|
|00005670| 6e 20 74 68 65 20 6f 62 | 6a 65 63 74 20 74 68 61 |n the ob|ject tha|
|00005680| 74 20 73 65 72 76 65 73 | 20 61 73 20 74 68 65 20 |t serves| as the |
|00005690| 6f 75 74 65 72 20 73 69 | 64 65 20 6f 66 20 74 68 |outer si|de of th|
|000056a0| 65 20 64 6f 6f 72 2e 0d | 0a 0d 0a 0d 0a 5c 6d 61 |e door..|.....\ma|
|000056b0| 6a 6f 72 73 65 63 74 69 | 6f 6e 7b 56 65 68 69 63 |jorsecti|on{Vehic|
|000056c0| 6c 65 73 7d 0d 0a 0d 0a | 5e 5e 7b 76 65 68 69 63 |les}....|^^{vehic|
|000056d0| 6c 65 73 7d 0d 0a 56 65 | 68 69 63 6c 65 73 20 61 |les}..Ve|hicles a|
|000056e0| 72 65 20 72 6f 6f 6d 73 | 20 74 68 61 74 20 6d 6f |re rooms| that mo|
|000056f0| 76 65 2e 20 20 42 61 73 | 69 63 61 6c 6c 79 2c 20 |ve. Bas|ically, |
|00005700| 61 20 76 65 68 69 63 6c | 65 20 69 73 20 61 6e 20 |a vehicl|e is an |
|00005710| 65 78 74 65 6e 73 69 6f | 6e 0d 0a 74 6f 20 74 68 |extensio|n..to th|
|00005720| 65 20 69 64 65 61 20 6f | 66 20 63 6f 6d 70 6c 65 |e idea o|f comple|
|00005730| 78 20 72 6f 6f 6d 20 69 | 6e 74 65 72 63 6f 6e 6e |x room i|nterconn|
|00005740| 65 63 74 69 6f 6e 73 3b | 20 72 61 74 68 65 72 20 |ections;| rather |
|00005750| 74 68 61 6e 20 68 61 76 | 69 6e 67 20 61 0d 0a 72 |than hav|ing a..r|
|00005760| 6f 6f 6d 20 69 6e 74 65 | 72 63 6f 6e 6e 65 63 74 |oom inte|rconnect|
|00005770| 69 6f 6e 20 74 68 61 74 | 20 6d 65 72 65 6c 79 20 |ion that| merely |
|00005780| 64 69 73 70 6c 61 79 73 | 20 61 20 6d 65 73 73 61 |displays| a messa|
|00005790| 67 65 2c 20 6f 72 20 73 | 6f 6d 65 74 69 6d 65 73 |ge, or s|ometimes|
|000057a0| 0d 0a 64 69 73 61 6c 6c | 6f 77 73 20 74 72 61 76 |..disall|ows trav|
|000057b0| 65 6c 2c 20 61 20 76 65 | 68 69 63 6c 65 20 68 61 |el, a ve|hicle ha|
|000057c0| 73 20 61 20 72 6f 6f 6d | 20 69 6e 74 65 72 63 6f |s a room| interco|
|000057d0| 6e 6e 65 63 74 69 6f 6e | 20 74 68 61 74 20 6d 6f |nnection| that mo|
|000057e0| 76 65 73 0d 0a 61 72 6f | 75 6e 64 2e 20 20 55 73 |ves..aro|und. Us|
|000057f0| 75 61 6c 6c 79 2c 20 61 | 20 76 65 68 69 63 6c 65 |ually, a| vehicle|
|00005800| 20 77 69 6c 6c 20 61 6c | 73 6f 20 68 61 76 65 20 | will al|so have |
|00005810| 73 6f 6d 65 20 6f 74 68 | 65 72 20 62 65 68 61 76 |some oth|er behav|
|00005820| 69 6f 72 2c 0d 0a 73 75 | 63 68 20 61 73 20 63 6f |ior,..su|ch as co|
|00005830| 6e 74 72 6f 6c 73 20 74 | 68 61 74 20 6f 70 65 72 |ntrols t|hat oper|
|00005840| 61 74 65 20 74 68 65 20 | 76 65 68 69 63 6c 65 2c |ate the |vehicle,|
|00005850| 20 6f 72 20 61 20 76 69 | 65 77 73 63 72 65 65 6e | or a vi|ewscreen|
|00005860| 20 74 68 61 74 0d 0a 73 | 68 6f 77 73 20 74 68 65 | that..s|hows the|
|00005870| 20 61 72 65 61 20 6f 75 | 74 73 69 64 65 20 74 68 | area ou|tside th|
|00005880| 65 20 76 65 68 69 63 6c | 65 2e 0d 0a 0d 0a 54 68 |e vehicl|e.....Th|
|00005890| 65 20 66 69 72 73 74 20 | 74 79 70 65 20 6f 66 20 |e first |type of |
|000058a0| 76 65 68 69 63 6c 65 20 | 77 65 27 6c 6c 20 61 64 |vehicle |we'll ad|
|000058b0| 64 72 65 73 73 20 69 73 | 20 74 68 65 20 66 75 6c |dress is| the ful|
|000058c0| 6c 79 2d 65 6e 63 6c 6f | 73 65 64 0d 0a 76 61 72 |ly-enclo|sed..var|
|000058d0| 69 65 74 79 2c 20 73 75 | 63 68 20 61 73 20 61 20 |iety, su|ch as a |
|000058e0| 73 75 62 77 61 79 20 74 | 72 61 69 6e 20 6f 72 20 |subway t|rain or |
|000058f0| 61 6e 20 65 6c 65 76 61 | 74 6f 72 2e 20 20 57 65 |an eleva|tor. We|
|00005900| 27 6c 6c 20 61 64 64 72 | 65 73 73 0d 0a 76 65 68 |'ll addr|ess..veh|
|00005910| 69 63 6c 65 73 20 74 68 | 61 74 20 61 72 65 20 61 |icles th|at are a|
|00005920| 6c 73 6f 20 6f 62 6a 65 | 63 74 73 20 69 6e 20 74 |lso obje|cts in t|
|00005930| 68 65 69 72 20 6f 77 6e | 20 72 69 67 68 74 2c 20 |heir own| right, |
|00005940| 73 75 63 68 20 61 73 20 | 72 75 62 62 65 72 0d 0a |such as |rubber..|
|00005950| 72 61 66 74 73 2c 20 69 | 6e 20 61 20 6c 61 74 65 |rafts, i|n a late|
|00005960| 72 20 73 65 63 74 69 6f | 6e 20 28 60 60 4e 65 73 |r sectio|n (``Nes|
|00005970| 74 65 64 20 52 6f 6f 6d | 20 56 65 68 69 63 6c 65 |ted Room| Vehicle|
|00005980| 73 27 27 20 62 65 6c 6f | 77 29 2e 20 20 41 0d 0a |s'' belo|w). A..|
|00005990| 66 75 6c 6c 79 2d 65 6e | 63 6c 6f 73 65 64 20 76 |fully-en|closed v|
|000059a0| 65 68 69 63 6c 65 20 72 | 65 61 6c 6c 79 20 6a 75 |ehicle r|eally ju|
|000059b0| 73 74 20 61 6d 6f 75 6e | 74 73 20 74 6f 20 61 20 |st amoun|ts to a |
|000059c0| 72 6f 6f 6d 20 74 68 61 | 74 20 68 61 73 0d 0a 61 |room tha|t has..a|
|000059d0| 20 64 69 72 65 63 74 69 | 6f 6e 20 70 72 6f 70 65 | directi|on prope|
|000059e0| 72 74 79 20 74 68 61 74 | 20 63 68 61 6e 67 65 73 |rty that| changes|
|000059f0| 2c 20 64 65 70 65 6e 64 | 69 6e 67 20 6f 6e 20 77 |, depend|ing on w|
|00005a00| 68 65 72 65 20 74 68 65 | 20 76 65 68 69 63 6c 65 |here the| vehicle|
|00005a10| 0d 0a 69 73 20 73 75 70 | 70 6f 73 65 64 20 74 6f |..is sup|posed to|
|00005a20| 20 62 65 2e 20 20 54 68 | 65 20 76 65 68 69 63 6c | be. Th|e vehicl|
|00005a30| 65 20 64 6f 65 73 6e 27 | 74 20 68 61 76 65 20 61 |e doesn'|t have a|
|00005a40| 20 7b 5c 74 74 20 6c 6f | 63 61 74 69 6f 6e 7d 0d | {\tt lo|cation}.|
|00005a50| 0a 70 72 6f 70 65 72 74 | 79 2c 20 62 65 63 61 75 |.propert|y, becau|
|00005a60| 73 65 20 69 74 27 73 20 | 6a 75 73 74 20 61 6e 20 |se it's |just an |
|00005a70| 6f 72 64 69 6e 61 72 79 | 20 72 6f 6f 6d 2d 2d 2d |ordinary| room---|
|00005a80| 69 74 27 73 20 6e 6f 74 | 20 61 6e 20 6f 62 6a 65 |it's not| an obje|
|00005a90| 63 74 0d 0a 69 6e 20 6f | 74 68 65 72 20 72 6f 6f |ct..in o|ther roo|
|00005aa0| 6d 73 2e 0d 0a 0d 0a 41 | 73 20 61 6e 20 65 78 61 |ms.....A|s an exa|
|00005ab0| 6d 70 6c 65 2c 20 6c 65 | 74 27 73 20 69 6d 70 6c |mple, le|t's impl|
|00005ac0| 65 6d 65 6e 74 20 61 6e | 20 65 6c 65 76 61 74 6f |ement an| elevato|
|00005ad0| 72 20 74 68 61 74 20 74 | 72 61 76 65 6c 73 20 62 |r that t|ravels b|
|00005ae0| 65 74 77 65 65 6e 0d 0a | 74 77 6f 20 66 6c 6f 6f |etween..|two floo|
|00005af0| 72 73 2e 20 20 54 68 65 | 20 65 6c 65 76 61 74 6f |rs. The| elevato|
|00005b00| 72 20 77 69 6c 6c 20 68 | 61 76 65 20 60 60 75 70 |r will h|ave ``up|
|00005b10| 27 27 20 61 6e 64 20 60 | 60 64 6f 77 6e 27 27 20 |'' and `|`down'' |
|00005b20| 62 75 74 74 6f 6e 73 0d | 0a 74 6f 20 61 63 74 69 |buttons.|.to acti|
|00005b30| 76 61 74 65 20 69 74 2c | 20 64 6f 6f 72 73 2c 20 |vate it,| doors, |
|00005b40| 61 6e 64 20 61 20 64 69 | 73 70 6c 61 79 20 69 6e |and a di|splay in|
|00005b50| 64 69 63 61 74 69 6e 67 | 20 77 68 69 63 68 20 6c |dicating| which l|
|00005b60| 65 76 65 6c 20 69 74 27 | 73 0d 0a 6f 6e 2e 0d 0a |evel it'|s..on...|
|00005b70| 0d 0a 54 6f 20 6d 61 6b | 65 20 74 68 65 20 65 6c |..To mak|e the el|
|00005b80| 65 76 61 74 6f 72 20 6d | 6f 72 65 20 72 65 61 6c |evator m|ore real|
|00005b90| 69 73 74 69 63 2c 20 77 | 65 27 6c 6c 20 61 72 72 |istic, w|e'll arr|
|00005ba0| 61 6e 67 65 20 66 6f 72 | 20 69 74 20 74 6f 20 73 |ange for| it to s|
|00005bb0| 70 65 6e 64 0d 0a 61 20 | 63 6f 75 70 6c 65 20 6f |pend..a |couple o|
|00005bc0| 66 20 74 75 72 6e 73 20 | 69 6e 20 74 72 61 6e 73 |f turns |in trans|
|00005bd0| 69 74 20 61 73 20 69 74 | 20 6d 6f 76 65 73 20 62 |it as it| moves b|
|00005be0| 65 74 77 65 65 6e 20 66 | 6c 6f 6f 72 73 2e 20 20 |etween f|loors. |
|00005bf0| 54 6f 0d 0a 64 6f 20 74 | 68 69 73 2c 20 77 65 27 |To..do t|his, we'|
|00005c00| 6c 6c 20 75 73 65 20 61 | 20 60 60 6e 6f 74 69 66 |ll use a| ``notif|
|00005c10| 69 65 72 27 27 20 66 75 | 6e 63 74 69 6f 6e 20 74 |ier'' fu|nction t|
|00005c20| 68 61 74 27 73 20 73 65 | 74 20 77 68 65 6e 20 61 |hat's se|t when a|
|00005c30| 0d 0a 62 75 74 74 6f 6e | 20 69 73 20 75 73 65 64 |..button| is used|
|00005c40| 20 74 6f 20 73 74 61 72 | 74 20 74 68 65 20 65 6c | to star|t the el|
|00005c50| 65 76 61 74 6f 72 20 6f | 6e 20 69 74 73 20 77 61 |evator o|n its wa|
|00005c60| 79 2e 20 20 57 65 27 6c | 6c 20 61 6c 73 6f 0d 0a |y. We'l|l also..|
|00005c70| 75 73 65 20 61 20 66 6c | 61 67 20 74 6f 20 69 6e |use a fl|ag to in|
|00005c80| 64 69 63 61 74 65 20 77 | 68 65 6e 20 74 68 65 20 |dicate w|hen the |
|00005c90| 65 6c 65 76 61 74 6f 72 | 20 69 73 20 69 6e 20 74 |elevator| is in t|
|00005ca0| 72 61 6e 73 69 74 2c 20 | 73 6f 20 74 68 61 74 0d |ransit, |so that.|
|00005cb0| 0a 70 75 73 68 69 6e 67 | 20 74 68 65 20 62 75 74 |.pushing| the but|
|00005cc0| 74 6f 6e 73 20 77 68 69 | 6c 65 20 74 68 65 20 65 |tons whi|le the e|
|00005cd0| 6c 65 76 61 74 6f 72 20 | 69 73 20 6d 6f 76 69 6e |levator |is movin|
|00005ce0| 67 20 77 69 6c 6c 20 68 | 61 76 65 20 6e 6f 20 65 |g will h|ave no e|
|00005cf0| 66 66 65 63 74 2e 0d 0a | 0d 0a 54 68 65 20 64 6f |ffect...|..The do|
|00005d00| 6f 72 73 20 77 69 6c 6c | 20 62 65 20 73 69 6d 70 |ors will| be simp|
|00005d10| 6c 65 72 20 74 68 61 6e | 20 6e 6f 72 6d 61 6c 20 |ler than| normal |
|00005d20| 64 6f 6f 72 73 2c 20 73 | 69 6e 63 65 20 74 68 65 |doors, s|ince the|
|00005d30| 20 75 73 65 72 20 63 61 | 6e 27 74 0d 0a 64 69 72 | user ca|n't..dir|
|00005d40| 65 63 74 6c 79 20 6d 61 | 6e 69 70 75 6c 61 74 65 |ectly ma|nipulate|
|00005d50| 20 74 68 65 6d 2e 20 20 | 54 68 65 79 27 6c 6c 20 | them. |They'll |
|00005d60| 6f 70 65 6e 20 61 6e 64 | 20 63 6c 6f 73 65 20 61 |open and| close a|
|00005d70| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 2e 0d 0a 0d |utomatic|ally....|
|00005d80| 0a 7b 5c 65 78 61 6d 70 | 6c 65 0d 0a 5c 6f 62 6a |.{\examp|le..\obj|
|00005d90| 65 63 74 7b 65 6c 65 76 | 44 6f 6f 72 73 3a 20 66 |ect{elev|Doors: f|
|00005da0| 69 78 65 64 69 74 65 6d | 7d 0d 0a 20 20 20 20 6c |ixeditem|}.. l|
|00005db0| 6f 63 61 74 69 6f 6e 20 | 3d 20 65 6c 65 76 52 6f |ocation |= elevRo|
|00005dc0| 6f 6d 0d 0a 20 20 20 20 | 6e 6f 75 6e 20 3d 20 27 |om.. |noun = '|
|00005dd0| 64 6f 6f 72 27 20 27 64 | 6f 6f 72 73 27 0d 0a 20 |door' 'd|oors'.. |
|00005de0| 20 20 20 61 64 6a 65 63 | 74 69 76 65 20 3d 20 27 | adjec|tive = '|
|00005df0| 65 6c 65 76 61 74 6f 72 | 27 20 27 73 6c 69 64 69 |elevator|' 'slidi|
|00005e00| 6e 67 27 0d 0a 20 20 20 | 20 73 64 65 73 63 20 3d |ng'.. | sdesc =|
|00005e10| 20 22 65 6c 65 76 61 74 | 6f 72 20 64 6f 6f 72 73 | "elevat|or doors|
|00005e20| 22 0d 0a 20 20 20 20 6c | 64 65 73 63 20 3d 20 22 |".. l|desc = "|
|00005e30| 54 68 65 79 27 72 65 20 | 61 20 73 74 61 6e 64 61 |They're |a standa|
|00005e40| 72 64 20 70 61 69 72 20 | 6f 66 20 73 6c 69 64 69 |rd pair |of slidi|
|00005e50| 6e 67 20 65 6c 65 76 61 | 74 6f 72 20 64 6f 6f 72 |ng eleva|tor door|
|00005e60| 73 2e 0d 0a 20 20 20 20 | 20 20 20 54 68 65 79 27 |s... | They'|
|00005e70| 72 65 20 63 75 72 72 65 | 6e 74 6c 79 20 3c 3c 73 |re curre|ntly <<s|
|00005e80| 65 6c 66 2e 69 73 6f 70 | 65 6e 20 3f 20 22 6f 70 |elf.isop|en ? "op|
|00005e90| 65 6e 22 20 3a 20 22 63 | 6c 6f 73 65 64 22 3e 3e |en" : "c|losed">>|
|00005ea0| 2e 20 22 0d 0a 20 20 20 | 20 69 73 6f 70 65 6e 20 |. ".. | isopen |
|00005eb0| 3d 20 74 72 75 65 0d 0a | 20 20 20 20 76 65 72 44 |= true..| verD|
|00005ec0| 6f 4f 70 65 6e 28 61 63 | 74 6f 72 29 20 3d 0d 0a |oOpen(ac|tor) =..|
|00005ed0| 20 20 20 20 5c 6c 62 0d | 0a 20 20 20 20 20 20 20 | \lb.|. |
|00005ee0| 20 22 54 68 65 20 64 6f | 6f 72 73 20 61 72 65 20 | "The do|ors are |
|00005ef0| 61 75 74 6f 6d 61 74 69 | 63 3b 20 79 6f 75 20 63 |automati|c; you c|
|00005f00| 61 6e 27 74 20 6f 70 65 | 6e 20 74 68 65 6d 20 79 |an't ope|n them y|
|00005f10| 6f 75 72 73 65 6c 66 2e | 20 22 3b 0d 0a 20 20 20 |ourself.| ";.. |
|00005f20| 20 5c 72 62 0d 0a 20 20 | 20 20 76 65 72 44 6f 43 | \rb.. | verDoC|
|00005f30| 6c 6f 73 65 28 61 63 74 | 6f 72 29 20 3d 0d 0a 20 |lose(act|or) =.. |
|00005f40| 20 20 20 5c 6c 62 0d 0a | 20 20 20 20 20 20 20 20 | \lb..| |
|00005f50| 22 54 68 65 20 64 6f 6f | 72 73 20 61 72 65 20 61 |"The doo|rs are a|
|00005f60| 75 74 6f 6d 61 74 69 63 | 3b 20 79 6f 75 20 63 61 |utomatic|; you ca|
|00005f70| 6e 27 74 20 63 6c 6f 73 | 65 20 74 68 65 6d 20 79 |n't clos|e them y|
|00005f80| 6f 75 72 73 65 6c 66 2e | 20 22 3b 0d 0a 20 20 20 |ourself.| ";.. |
|00005f90| 20 5c 72 62 0d 0a 5c 65 | 6e 64 6f 62 6a 0d 0a 7d | \rb..\e|ndobj..}|
|00005fa0| 0d 0a 0d 0a 54 68 65 20 | 5e 7b 62 75 74 74 6f 6e |....The |^{button|
|00005fb0| 73 7d 20 61 72 65 20 66 | 61 69 72 6c 79 20 73 69 |s} are f|airly si|
|00005fc0| 6d 70 6c 65 3a 20 20 74 | 68 65 79 20 75 73 65 20 |mple: t|hey use |
|00005fd0| 74 68 65 20 62 61 73 69 | 63 20 7b 5c 74 74 20 62 |the basi|c {\tt b|
|00005fe0| 75 74 74 6f 6e 69 74 65 | 6d 7d 0d 0a 63 6c 61 73 |uttonite|m}..clas|
|00005ff0| 73 2e 20 20 57 65 27 6c | 6c 20 73 65 74 20 61 20 |s. We'l|l set a |
|00006000| 70 72 6f 70 65 72 74 79 | 20 69 6e 64 69 63 61 74 |property| indicat|
|00006010| 69 6e 67 20 74 68 65 20 | 64 65 73 74 69 6e 61 74 |ing the |destinat|
|00006020| 69 6f 6e 20 6f 66 20 74 | 68 65 0d 0a 65 6c 65 76 |ion of t|he..elev|
|00006030| 61 74 6f 72 20 77 68 65 | 6e 20 74 68 61 74 20 62 |ator whe|n that b|
|00006040| 75 74 74 6f 6e 20 69 73 | 20 70 75 73 68 65 64 2d |utton is| pushed-|
|00006050| 2d 2d 74 68 65 20 60 60 | 75 70 27 27 20 62 75 74 |--the ``|up'' but|
|00006060| 74 6f 6e 20 77 69 6c 6c | 0d 0a 74 61 6b 65 20 74 |ton will|..take t|
|00006070| 68 65 20 65 6c 65 76 61 | 74 6f 72 20 74 6f 20 74 |he eleva|tor to t|
|00006080| 68 65 20 75 70 70 65 72 | 20 66 6c 6f 6f 72 2c 20 |he upper| floor, |
|00006090| 61 6e 64 20 74 68 65 20 | 60 60 64 6f 77 6e 27 27 |and the |``down''|
|000060a0| 20 62 75 74 74 6f 6e 0d | 0a 77 69 6c 6c 20 74 61 | button.|.will ta|
|000060b0| 6b 65 20 74 68 65 20 65 | 6c 65 76 61 74 6f 72 20 |ke the e|levator |
|000060c0| 74 6f 20 74 68 65 20 6c | 6f 77 65 72 20 66 6c 6f |to the l|ower flo|
|000060d0| 6f 72 2e 0d 0a 54 68 65 | 20 7b 5c 74 74 20 64 6f |or...The| {\tt do|
|000060e0| 50 75 73 68 7d 20 6d 65 | 74 68 6f 64 20 63 68 65 |Push} me|thod che|
|000060f0| 63 6b 73 20 74 6f 20 73 | 65 65 20 69 66 20 74 68 |cks to s|ee if th|
|00006100| 65 20 65 6c 65 76 61 74 | 6f 72 20 69 73 0d 0a 61 |e elevat|or is..a|
|00006110| 6c 72 65 61 64 79 20 6d | 6f 76 69 6e 67 2c 20 61 |lready m|oving, a|
|00006120| 6e 64 20 74 68 65 6e 20 | 74 6f 20 73 65 65 20 69 |nd then |to see i|
|00006130| 66 20 74 68 65 20 65 6c | 65 76 61 74 6f 72 20 69 |f the el|evator i|
|00006140| 73 20 61 6c 72 65 61 64 | 79 20 61 74 0d 0a 74 68 |s alread|y at..th|
|00006150| 65 20 64 65 73 74 69 6e | 61 74 69 6f 6e 20 6f 66 |e destin|ation of|
|00006160| 20 74 68 69 73 20 62 75 | 74 74 6f 6e 2e 0d 0a 0d | this bu|tton....|
|00006170| 0a 54 6f 20 6d 61 6b 65 | 20 6c 65 73 73 20 77 6f |.To make| less wo|
|00006180| 72 6b 20 66 6f 72 20 6f | 75 72 73 65 6c 76 65 73 |rk for o|urselves|
|00006190| 2c 20 77 65 27 6c 6c 20 | 64 65 66 69 6e 65 20 61 |, we'll |define a|
|000061a0| 20 63 6c 61 73 73 20 66 | 6f 72 20 74 68 65 0d 0a | class f|or the..|
|000061b0| 74 77 6f 20 65 6c 65 76 | 61 74 6f 72 20 62 75 74 |two elev|ator but|
|000061c0| 74 6f 6e 73 2c 20 74 68 | 65 6e 20 6d 61 6b 65 20 |tons, th|en make |
|000061d0| 74 77 6f 20 6f 62 6a 65 | 63 74 73 20 62 61 73 65 |two obje|cts base|
|000061e0| 64 20 6f 6e 20 74 68 65 | 20 63 6c 61 73 73 2e 0d |d on the| class..|
|000061f0| 0a 0d 0a 7b 5c 65 78 61 | 6d 70 6c 65 0d 0a 5c 6f |...{\exa|mple..\o|
|00006200| 62 6a 65 63 74 7b 63 6c | 61 73 73 20 65 6c 65 76 |bject{cl|ass elev|
|00006210| 42 75 74 74 6f 6e 3a 20 | 62 75 74 74 6f 6e 69 74 |Button: |buttonit|
|00006220| 65 6d 7d 0d 0a 20 20 20 | 20 6c 6f 63 61 74 69 6f |em}.. | locatio|
|00006230| 6e 20 3d 20 65 6c 65 76 | 52 6f 6f 6d 0d 0a 20 20 |n = elev|Room.. |
|00006240| 20 20 64 6f 50 75 73 68 | 28 61 63 74 6f 72 29 20 | doPush|(actor) |
|00006250| 3d 0d 0a 20 20 20 20 5c | 6c 62 0d 0a 20 20 20 20 |=.. \|lb.. |
|00006260| 20 20 20 20 2f 2a 20 69 | 67 6e 6f 72 65 20 69 66 | /* i|gnore if|
|00006270| 20 61 6c 72 65 61 64 79 | 20 69 6e 20 6d 6f 74 69 | already| in moti|
|00006280| 6f 6e 20 6f 72 20 61 6c | 72 65 61 64 79 20 61 74 |on or al|ready at|
|00006290| 20 64 65 73 74 69 6e 61 | 74 69 6f 6e 20 2a 2f 0d | destina|tion */.|
|000062a0| 0a 20 20 20 20 20 20 20 | 20 69 66 20 28 65 6c 65 |. | if (ele|
|000062b0| 76 52 6f 6f 6d 2e 69 73 | 41 63 74 69 76 65 20 6f |vRoom.is|Active o|
|000062c0| 72 20 65 6c 65 76 52 6f | 6f 6d 2e 63 75 72 66 6c |r elevRo|om.curfl|
|000062d0| 6f 6f 72 20 3d 20 73 65 | 6c 66 2e 64 65 73 74 69 |oor = se|lf.desti|
|000062e0| 6e 61 74 69 6f 6e 29 0d | 0a 20 20 20 20 20 20 20 |nation).|. |
|000062f0| 20 5c 69 6e 76 69 73 6c | 62 0d 0a 20 20 20 20 20 | \invisl|b.. |
|00006300| 20 20 20 20 20 20 20 22 | 5c 63 68 61 72 60 5c 5c | "|\char`\\|
|00006310| 22 43 6c 69 63 6b 2e 5c | 63 68 61 72 60 5c 5c 22 |"Click.\|char`\\"|
|00006320| 22 3b 0d 0a 20 20 20 20 | 20 20 20 20 5c 69 6e 76 |";.. | \inv|
|00006330| 69 73 72 62 0d 0a 20 20 | 20 20 20 20 20 20 65 6c |isrb.. | el|
|00006340| 73 65 0d 0a 20 20 20 20 | 20 20 20 20 5c 6c 62 0d |se.. | \lb.|
|00006350| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 22 54 68 |. | "Th|
|00006360| 65 20 64 6f 6f 72 73 20 | 63 6c 6f 73 65 2c 20 61 |e doors |close, a|
|00006370| 6e 64 20 74 68 65 20 65 | 6c 65 76 61 74 6f 72 20 |nd the e|levator |
|00006380| 73 74 61 72 74 73 20 74 | 6f 20 6d 6f 76 65 2e 22 |starts t|o move."|
|00006390| 3b 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 65 |;.. | e|
|000063a0| 6c 65 76 52 6f 6f 6d 2e | 69 73 41 63 74 69 76 65 |levRoom.|isActive|
|000063b0| 20 3a 3d 20 74 72 75 65 | 3b 0d 0a 20 20 20 20 20 | := true|;.. |
|000063c0| 20 20 20 20 20 20 20 65 | 6c 65 76 44 6f 6f 72 73 | e|levDoors|
|000063d0| 2e 69 73 6f 70 65 6e 20 | 3a 3d 20 6e 69 6c 3b 0d |.isopen |:= nil;.|
|000063e0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 65 6c 65 |. | ele|
|000063f0| 76 52 6f 6f 6d 2e 63 6f | 75 6e 74 65 72 20 3a 3d |vRoom.co|unter :=|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.